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-12T11:56:17.764Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-04-12T11:56:18.063Z';
  ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-05-08T11:56:18.128Z';
  ALTER TABLE "pages" ALTER COLUMN "slug" SET DEFAULT '';
  ALTER TABLE "_pages_v" ALTER COLUMN "version_slug" SET DEFAULT '';`)
}

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: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 "pages" ALTER COLUMN "slug" DROP DEFAULT;
  ALTER TABLE "_pages_v" ALTER COLUMN "version_slug" DROP DEFAULT;`)
}
