2024-04-23 10:31:26 +02:00
|
|
|
import { Kysely, sql } from "kysely";
|
|
|
|
|
|
|
|
|
|
export async function up(db: Kysely<any>): Promise<void> {
|
|
|
|
|
await db.schema
|
|
|
|
|
.createTable("FacebookBot")
|
|
|
|
|
.addColumn("id", "uuid", (col) =>
|
|
|
|
|
col.primaryKey().defaultTo(sql`gen_random_uuid()`),
|
|
|
|
|
)
|
2024-04-24 21:44:05 +02:00
|
|
|
.addColumn("name", "text")
|
2024-04-23 10:31:26 +02:00
|
|
|
.addColumn("description", "text")
|
2024-04-24 21:44:05 +02:00
|
|
|
.addColumn("token", "text")
|
|
|
|
|
.addColumn("page_access_token", "text")
|
|
|
|
|
.addColumn("app_secret", "text")
|
|
|
|
|
.addColumn("verify_token", "text")
|
|
|
|
|
.addColumn("page_id", "text")
|
|
|
|
|
.addColumn("app_id", "text")
|
|
|
|
|
.addColumn("user_id", "uuid")
|
2024-04-23 10:31:26 +02:00
|
|
|
.addColumn("is_verified", "boolean", (col) =>
|
|
|
|
|
col.notNull().defaultTo(false),
|
|
|
|
|
)
|
|
|
|
|
.addColumn("created_at", "timestamptz", (col) =>
|
|
|
|
|
col.notNull().defaultTo(sql`now()`),
|
|
|
|
|
)
|
|
|
|
|
.addColumn("updated_at", "timestamptz", (col) =>
|
|
|
|
|
col.notNull().defaultTo(sql`now()`),
|
|
|
|
|
)
|
|
|
|
|
.execute();
|
|
|
|
|
|
|
|
|
|
await db.schema
|
|
|
|
|
.createIndex("FacebookBotToken")
|
|
|
|
|
.on("FacebookBot")
|
|
|
|
|
.column("token")
|
|
|
|
|
.execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function down(db: Kysely<any>): Promise<void> {
|
|
|
|
|
await db.schema.dropTable("FacebookBot").ifExists().execute();
|
|
|
|
|
}
|