import { Kysely, sql } from "kysely"; export async function up(db: Kysely): Promise { await db.schema .createTable("FacebookBot") .addColumn("id", "uuid", (col) => col.primaryKey().defaultTo(sql`gen_random_uuid()`), ) .addColumn("name", "text") .addColumn("description", "text") .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") .addColumn("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): Promise { await db.schema.dropTable("FacebookBot").ifExists().execute(); }