diff --git a/src/db.ts b/src/db.ts index 7da67ed..474652c 100644 --- a/src/db.ts +++ b/src/db.ts @@ -37,6 +37,8 @@ interface UserRow { interface RelayRow { url: string; + domain: string; + active: boolean; } const db = new Kysely({ diff --git a/src/db/migrations/001_add_relays.ts b/src/db/migrations/001_add_relays.ts index 41f73a9..1415f5f 100644 --- a/src/db/migrations/001_add_relays.ts +++ b/src/db/migrations/001_add_relays.ts @@ -5,6 +5,7 @@ export async function up(db: Kysely): Promise { .createTable('relays') .addColumn('url', 'text', (col) => col.primaryKey()) .addColumn('domain', 'text', (col) => col.notNull()) + .addColumn('active', 'boolean', (col) => col.notNull()) .execute(); } diff --git a/src/db/relays.ts b/src/db/relays.ts index 65b009d..89c9fcb 100644 --- a/src/db/relays.ts +++ b/src/db/relays.ts @@ -7,7 +7,8 @@ function addRelays(relays: `wss://${string}`[]) { const values = relays.map((url) => ({ url, - domain: tldts.getDomain(url), + domain: tldts.getDomain(url)!, + active: true, })); return db.insertInto('relays')