Skip to content

Commit 3d05a37

Browse files
authored
Merge pull request #52 from GeneralMagicio/add-createdAt-and-updatedAt-to-userAction
add createdAt and updatedAt to userAction
2 parents 199d109 + 91bfb57 commit 3d05a37

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"start:dev": "nest start --watch",
1414
"start:debug": "nest start --debug --watch",
1515
"start:prod": "node dist/main",
16-
"migration:dev": "npx prisma migrate dev",
1716
"migration:prod": "npx prisma migrate deploy",
1817
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
1918
"test": "jest",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- DropColumn
2+
ALTER TABLE "UserAction" DROP COLUMN "actionID";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- AlterTable
2+
ALTER TABLE "UserAction" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
3+
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;

prisma/schema.prisma

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ model User {
2626
}
2727

2828
model UserAction {
29-
id Int @id @default(autoincrement())
30-
userId Int
31-
pollId Int
32-
type ActionType
33-
user User @relation(fields: [userId], references: [id])
34-
poll Poll @relation(fields: [pollId], references: [pollId],onDelete: Cascade)
29+
id Int @id @default(autoincrement())
30+
userId Int
31+
pollId Int
32+
type ActionType
33+
user User @relation(fields: [userId], references: [id])
34+
poll Poll @relation(fields: [pollId], references: [pollId], onDelete: Cascade)
35+
createdAt DateTime @default(now())
36+
updatedAt DateTime @default(now()) @updatedAt
3537
}
3638

3739
model Poll {
@@ -58,9 +60,9 @@ model Vote {
5860
pollId Int
5961
votingPower Int
6062
weightDistribution Json
61-
proof String
62-
user User @relation(fields: [userId], references: [id])
63-
poll Poll @relation(fields: [pollId], references: [pollId],onDelete: Cascade)
63+
proof String
64+
user User @relation(fields: [userId], references: [id])
65+
poll Poll @relation(fields: [pollId], references: [pollId], onDelete: Cascade)
6466
}
6567

6668
enum ActionType {

0 commit comments

Comments
 (0)