Skip to content

Commit be590f9

Browse files
committed
add migration
1 parent 86f6077 commit be590f9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Kysely } from 'kysely'
2+
import { createTableMigration } from '../migration.util'
3+
4+
export async function up(db: Kysely<unknown>): Promise<void> {
5+
await createTableMigration(db, 'apikeys')
6+
.addColumn('key', 'text', (col) => col.unique().notNull())
7+
.addColumn('project_id', 'integer', (col) =>
8+
col.references('projects.id').onDelete('cascade').notNull()
9+
)
10+
.execute()
11+
}
12+
13+
export async function down(db: Kysely<unknown>): Promise<void> {
14+
await db.schema.dropTable('apikeys').execute()
15+
}

0 commit comments

Comments
 (0)