Stockage du montant de la modification plutôt que le avant/après
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `after` on the `MoneyUpdate` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `before` on the `MoneyUpdate` table. All the data in the column will be lost.
|
||||
- Added the required column `amount` to the `MoneyUpdate` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "MoneyUpdate" DROP COLUMN "after",
|
||||
DROP COLUMN "before",
|
||||
ADD COLUMN "amount" INTEGER NOT NULL,
|
||||
ADD COLUMN "timestamp" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
@ -52,7 +52,7 @@ model ChallengeAction {
|
||||
end DateTime? @db.Timestamptz(3)
|
||||
penaltyStart DateTime? @db.Timestamptz(3)
|
||||
penaltyEnd DateTime? @db.Timestamptz(3)
|
||||
moneyUpdate MoneyUpdate?
|
||||
moneyUpdate MoneyUpdate?
|
||||
}
|
||||
|
||||
model TrainTrip {
|
||||
@ -69,16 +69,16 @@ model TrainTrip {
|
||||
}
|
||||
|
||||
model MoneyUpdate {
|
||||
id Int @id @default(autoincrement())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
before Int
|
||||
after Int
|
||||
reason MoneyUpdateType
|
||||
action ChallengeAction? @relation(fields: [actionId], references: [id])
|
||||
actionId Int? @unique
|
||||
trip TrainTrip? @relation(fields: [tripId], references: [id])
|
||||
tripId String? @unique
|
||||
id Int @id @default(autoincrement())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
amount Int
|
||||
reason MoneyUpdateType
|
||||
action ChallengeAction? @relation(fields: [actionId], references: [id])
|
||||
actionId Int? @unique
|
||||
trip TrainTrip? @relation(fields: [tripId], references: [id])
|
||||
tripId String? @unique
|
||||
timestamp DateTime @default(now()) @db.Timestamptz(3)
|
||||
}
|
||||
|
||||
enum MoneyUpdateType {
|
||||
|
Reference in New Issue
Block a user