mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-27 18:24:27 +01:00
db/relays: add active column
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user