22 lines
806 B
TypeScript
22 lines
806 B
TypeScript
|
import { Kysely } from 'kysely'
|
||
|
|
||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||
|
await db.schema
|
||
|
.createTable('Order_State')
|
||
|
.addColumn('id', 'varchar', col => col.primaryKey().notNull())
|
||
|
.addColumn('orders', 'jsonb', col => col.notNull())
|
||
|
.addColumn('completed', 'boolean', col => col.notNull())
|
||
|
.addColumn('payment', 'varchar', col => col.notNull())
|
||
|
.execute()
|
||
|
await db.schema
|
||
|
.createTable('Order_Number')
|
||
|
// current date. (e.g. 2024-04-19)
|
||
|
.addColumn('id', 'varchar', col => col.primaryKey().notNull())
|
||
|
.addColumn('number', 'integer', col => col.notNull())
|
||
|
.execute()
|
||
|
}
|
||
|
|
||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||
|
await db.schema.dropTable('Order_State').execute()
|
||
|
await db.schema.dropTable('Order_Number').execute()
|
||
|
}
|