mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
* Initial * Progress * Fix * Progress * Notifications list page * BADGE_MANAGER_ADDED * Mark as seen initial * Split tables * Progress * Fix styles * Push notifs initial * Progress * Rename * Routines * Progress * Add e2e tests * Done? * Try updating actions * Consistency * Dep fix * A couple fixes
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
export function up(db) {
|
|
db.transaction(() => {
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "Notification" (
|
|
"id" integer primary key,
|
|
"type" text not null,
|
|
"meta" text,
|
|
"pictureUrl" text,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index notification_type on "Notification"("type")`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "NotificationUser" (
|
|
"notificationId" integer not null,
|
|
"userId" integer not null,
|
|
"seen" integer default 0 not null,
|
|
unique("notificationId", "userId"),
|
|
foreign key ("notificationId") references "Notification"("id") on delete cascade,
|
|
foreign key ("userId") references "User"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index notification_user_id on "NotificationUser"("userId")`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "NotificationUserSubscription" (
|
|
"id" integer primary key,
|
|
"userId" integer not null,
|
|
"subscription" text not null,
|
|
foreign key ("userId") references "User"("id") on delete cascade
|
|
) strict
|
|
`,
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `create index notification_push_url_user_id on "NotificationUserSubscription"("userId")`,
|
|
).run();
|
|
})();
|
|
}
|