when an issue is deleted, TimedSession's issueId is set to null

This commit is contained in:
Oliver Bryan
2026-01-11 15:06:10 +00:00
parent bbde8adf08
commit c23b30eec2
4 changed files with 639 additions and 3 deletions

View File

@@ -84,9 +84,7 @@ export const TimedSession = pgTable("TimedSession", {
userId: integer()
.notNull()
.references(() => User.id),
issueId: integer()
.notNull()
.references(() => Issue.id),
issueId: integer().references(() => Issue.id, { onDelete: "set null" }),
timestamps: timestamp({ withTimezone: false }).array().notNull(),
endedAt: timestamp({ withTimezone: false }),
createdAt: timestamp({ withTimezone: false }).defaultNow(),