import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'

export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
  await db.execute(sql`
   ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-04-12T08:36:37.826Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-04-12T08:36:38.113Z';
  ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-05-09T08:36:38.168Z';
  ALTER TABLE "church_recurring_schedule" ADD COLUMN "default_description" varchar;`)
}

export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
  await db.execute(sql`
   ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-04-12T14:31:48.373Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-04-12T14:31:48.665Z';
  ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-05-08T14:31:48.733Z';
  ALTER TABLE "church_recurring_schedule" DROP COLUMN "default_description";`)
}
