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-03-22T22:44:18.451Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:44:18.743Z';
  ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T21:44:18.801Z';
  ALTER TABLE "contact_person" ADD COLUMN "role" varchar;`)
}

export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
  await db.execute(sql`
   ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:38:03.504Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:38:03.783Z';
  ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T21:38:03.836Z';
  ALTER TABLE "contact_person" DROP COLUMN "role";`)
}
