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

export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
  await payload.db.drizzle.execute(sql`
   ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2025-02-09T10:47:41.631Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2025-02-09T10:47:41.722Z';
  ALTER TABLE "event" ADD COLUMN "rsvp_link" varchar;`)
}

export async function down({ payload, req }: MigrateDownArgs): Promise<void> {
  await payload.db.drizzle.execute(sql`
   ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2025-02-02T14:51:44.981Z';
  ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2025-02-02T14:51:45.077Z';
  ALTER TABLE "event" DROP COLUMN IF EXISTS "rsvp_link";`)
}
