sendou.ink/migrations/114-live-streams.js
Kalle a004cf33b7
Store Twitch live streams in SQLite3 (#2738)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 16:51:44 +02:00

22 lines
568 B
JavaScript

export function up(db) {
db.transaction(() => {
db.prepare(
/*sql*/ `
create table "LiveStream" (
"id" integer primary key,
"userId" integer unique,
"viewerCount" integer not null,
"thumbnailUrl" text not null,
"twitch" text,
foreign key ("userId") references "User"("id") on delete cascade
) strict
`,
).run();
db.prepare(/*sql*/ `create index user_twitch on "User"("twitch")`).run();
db.prepare(
/*sql*/ `create index livestream_twitch on "LiveStream"("twitch")`,
).run();
})();
}