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