mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-24 07:44:28 +01:00
Add connections table
This commit is contained in:
17
src/db/migrations/023_add_connections.ts
Normal file
17
src/db/migrations/023_add_connections.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Kysely, sql } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.createTable('connections')
|
||||
.addColumn('api_token', 'text', (col) => col.primaryKey().unique().notNull())
|
||||
.addColumn('user_pubkey', 'text', (col) => col.notNull())
|
||||
.addColumn('server_seckey', 'blob', (col) => col.notNull())
|
||||
.addColumn('server_pubkey', 'text', (col) => col.notNull())
|
||||
.addColumn('relays', 'text', (col) => col.defaultTo('[]'))
|
||||
.addColumn('connected_at', 'timestamp', (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`))
|
||||
.execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema.dropTable('connections').execute();
|
||||
}
|
||||
Reference in New Issue
Block a user