db/users: add `admin` column

This commit is contained in:
Alex Gleason 2023-09-02 20:52:02 -05:00
parent c8a5da086e
commit f7d74c97ca
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 13 additions and 0 deletions

View File

@ -39,6 +39,7 @@ interface UserRow {
pubkey: string; pubkey: string;
username: string; username: string;
inserted_at: Date; inserted_at: Date;
admin: boolean;
} }
interface RelayRow { interface RelayRow {

View File

@ -0,0 +1,12 @@
import { Kysely } from '@/deps.ts';
export async function up(db: Kysely<any>): Promise<void> {
await db.schema
.alterTable('users')
.addColumn('admin', 'boolean', (col) => col.defaultTo(false))
.execute();
}
export async function down(db: Kysely<any>): Promise<void> {
await db.schema.dropTable('relays').execute();
}