db/relays: add `active` column
This commit is contained in:
parent
92f5bea891
commit
a0769d7c92
|
@ -37,6 +37,8 @@ interface UserRow {
|
|||
|
||||
interface RelayRow {
|
||||
url: string;
|
||||
domain: string;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
const db = new Kysely<DittoDB>({
|
||||
|
|
|
@ -5,6 +5,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
|||
.createTable('relays')
|
||||
.addColumn('url', 'text', (col) => col.primaryKey())
|
||||
.addColumn('domain', 'text', (col) => col.notNull())
|
||||
.addColumn('active', 'boolean', (col) => col.notNull())
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue