Skip to content

Commit e672ed6

Browse files
committed
fix: uptime schema
1 parent 1ea2d4e commit e672ed6

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

packages/db/src/drizzle/schema.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,11 @@ export const flagScheduleActionType = pgEnum("flag_schedule_type", [
677677
export type RolloutStep =
678678
| { scheduledAt: string; action: "enable" | "disable"; executedAt?: string }
679679
| {
680-
scheduledAt: string;
681-
action: "set_percentage";
682-
value: number;
683-
executedAt?: string;
684-
};
680+
scheduledAt: string;
681+
action: "set_percentage";
682+
value: number;
683+
executedAt?: string;
684+
};
685685
export const annotationType = pgEnum("annotation_type", [
686686
"point",
687687
"line",
@@ -838,7 +838,10 @@ export const uptimeSchedules = pgTable(
838838
"uptime_schedules",
839839
{
840840
id: text().primaryKey().notNull(),
841-
websiteId: text("website_id").notNull(),
841+
websiteId: text("website_id"),
842+
userId: text("user_id").notNull(),
843+
url: text().notNull(),
844+
name: text(),
842845
granularity: text("granularity").notNull(),
843846
cron: text().notNull(),
844847
isPaused: boolean("is_paused").default(false).notNull(),
@@ -850,12 +853,23 @@ export const uptimeSchedules = pgTable(
850853
"btree",
851854
table.websiteId.asc().nullsLast().op("text_ops")
852855
),
856+
index("uptime_schedules_user_id_idx").using(
857+
"btree",
858+
table.userId.asc().nullsLast().op("text_ops")
859+
),
853860
foreignKey({
854861
columns: [table.websiteId],
855862
foreignColumns: [websites.id],
856863
name: "uptime_schedules_website_id_fkey",
857864
})
858865
.onUpdate("cascade")
859866
.onDelete("cascade"),
867+
foreignKey({
868+
columns: [table.userId],
869+
foreignColumns: [user.id],
870+
name: "uptime_schedules_user_id_fkey",
871+
})
872+
.onUpdate("cascade")
873+
.onDelete("cascade"),
860874
]
861875
);

0 commit comments

Comments
 (0)