import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres"; /** * The per-prompt model override no longer carries a hardcoded default. An empty * value falls back to the UNSLOTH_MODEL environment variable at request time. * Clear the previously seeded value so the env var takes effect; rows an admin * deliberately set to a different model are left alone. */ export async function up({ db }: MigrateUpArgs): Promise { await db.execute(sql` ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "ornith_9b_settings_model" DROP DEFAULT; UPDATE "plugin_ai_instructions" SET "ornith_9b_settings_model" = NULL WHERE "ornith_9b_settings_model" = 'unsloth/Ornith-1.0-9B-GGUF'; `); } export async function down({ db }: MigrateDownArgs): Promise { await db.execute(sql` ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "ornith_9b_settings_model" SET DEFAULT 'unsloth/Ornith-1.0-9B-GGUF'; UPDATE "plugin_ai_instructions" SET "ornith_9b_settings_model" = 'unsloth/Ornith-1.0-9B-GGUF' WHERE "ornith_9b_settings_model" IS NULL; `); }