import { type MigrateUpArgs, type MigrateDownArgs, sql } from '@payloadcms/db-sqlite' export async function up({ db }: MigrateUpArgs): Promise { await db.run(sql`CREATE TABLE \`foundation_board\` ( \`_order\` integer NOT NULL, \`_parent_id\` integer NOT NULL, \`id\` text PRIMARY KEY NOT NULL, \`name\` text NOT NULL, \`role\` text DEFAULT 'member' NOT NULL, FOREIGN KEY (\`_parent_id\`) REFERENCES \`foundation\`(\`id\`) ON UPDATE no action ON DELETE cascade );`) await db.run(sql`CREATE INDEX \`foundation_board_order_idx\` ON \`foundation_board\` (\`_order\`);`) await db.run(sql`CREATE INDEX \`foundation_board_parent_id_idx\` ON \`foundation_board\` (\`_parent_id\`);`) await db.run(sql`CREATE TABLE \`foundation\` ( \`id\` integer PRIMARY KEY NOT NULL, \`founder\` text, \`director\` text, \`updated_at\` text, \`created_at\` text );`) } export async function down({ db }: MigrateDownArgs): Promise { await db.run(sql`DROP TABLE \`foundation_board\``) await db.run(sql`DROP TABLE \`foundation\``) }