Skip to content

Commit

Permalink
fix(Database): use re-generate migration to match db values
Browse files Browse the repository at this point in the history
  • Loading branch information
9teen90nine committed Aug 9, 2023
1 parent 5e4c55b commit 57fc58e
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-- AlterTable
ALTER TABLE "Activity" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Comment" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Estimate" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "EstimateToGoal" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Filter" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Flow" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Ghost" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Goal" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "GoalAchieveCriteria" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "GoalHistory" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Job" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Project" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Reaction" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Release" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Settings" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "State" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "Tag" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());

-- AlterTable
ALTER TABLE "User" ALTER COLUMN "createdAt" SET DEFAULT timezone('utc'::text, now()),
ALTER COLUMN "updatedAt" SET DEFAULT timezone('utc'::text, now());
68 changes: 34 additions & 34 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ model User {
activity Activity? @relation(fields: [activityId], references: [id])
activityId String? @unique
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model Ghost {
Expand All @@ -98,8 +98,8 @@ model Ghost {
hostId String
activity Activity?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@index([hostId])
}
Expand Down Expand Up @@ -131,8 +131,8 @@ model Activity {
releasesRead Release[] @relation("releasesRead")
releasesDelayed Release[] @relation("releasesDelayed")
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@index([ghostId])
}
Expand All @@ -154,8 +154,8 @@ model Project {
stargizers Activity[] @relation("projectStargizers")
averageScore Int?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model Estimate {
Expand All @@ -168,8 +168,8 @@ model Estimate {
activity Activity @relation(fields: [activityId], references: [id])
activityId String
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@index([date])
}
Expand All @@ -181,7 +181,7 @@ model EstimateToGoal {
estimate Estimate @relation(fields: [estimateId], references: [id])
estimateId Int
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
@@index([goalId])
@@index([estimateId])
Expand Down Expand Up @@ -232,8 +232,8 @@ model Goal {
goalAsCriteria GoalAchieveCriteria? @relation("GoalAsCriteria")
completedCriteriaWeight Int?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@unique([projectId, scopeId])
@@index([ownerId])
Expand All @@ -250,8 +250,8 @@ model Filter {
activityId String
stargizers Activity[] @relation("filterStargizers")
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model Comment {
Expand All @@ -265,8 +265,8 @@ model Comment {
stateId String?
reactions Reaction[]
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@index([activityId])
@@index([goalId])
Expand All @@ -282,8 +282,8 @@ model Reaction {
comment Comment? @relation(fields: [commentId], references: [id])
commentId String?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@index([activityId])
@@index([goalId])
Expand All @@ -299,8 +299,8 @@ model Flow {
states State[]
recommended Boolean?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model State {
Expand All @@ -313,8 +313,8 @@ model State {
goals Goal[] @relation("goalState")
comments Comment[]
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model Settings {
Expand All @@ -325,8 +325,8 @@ model Settings {
flowId String?
activity Activity?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model Tag {
Expand All @@ -338,8 +338,8 @@ model Tag {
activity Activity @relation(fields: [activityId], references: [id])
activityId String
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model Job {
Expand All @@ -353,8 +353,8 @@ model Job {
cron String?
error String?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

model GoalHistory {
Expand All @@ -368,7 +368,7 @@ model GoalHistory {
activity Activity @relation("goalActions", fields: [activityId], references: [id])
activityId String
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
@@index([id])
@@index([goalId])
Expand All @@ -387,8 +387,8 @@ model GoalAchieveCriteria {
activityId String
deleted Boolean?
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
@@index([title])
@@index([goalId])
Expand All @@ -400,6 +400,6 @@ model Release {
readers Activity[] @relation("releasesRead")
delayers Activity[] @relation("releasesDelayed")
createdAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc', current_timestamp)")) @updatedAt
createdAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @db.Timestamp()
updatedAt DateTime @default(dbgenerated("timezone('utc'::text, now())")) @updatedAt
}

0 comments on commit 57fc58e

Please sign in to comment.