1
0
Fork 0

chore(migrations): archive superseded migrations and add consolidated migration

Move old migrations (20260109 through 20260817) to _archived/ and add a
single consolidated migration (20260818_024510). Update the migrations
index to reference only the new migration.
This commit is contained in:
Jason Fraley 2026-08-18 02:05:56 -04:00
parent 72262d53b6
commit feccbc0ced
11 changed files with 16045 additions and 44 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,65 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
CREATE TYPE "public"."enum_plugin_ai_instructions_field_type" AS ENUM('text', 'textarea', 'upload', 'richText');
CREATE TYPE "public"."enum_plugin_ai_instructions_model_id" AS ENUM('unsloth-text');
CREATE TABLE "plugin_ai_instructions_images" (
"_order" integer NOT NULL,
"_parent_id" integer NOT NULL,
"id" varchar PRIMARY KEY NOT NULL,
"image_id" integer
);
CREATE TABLE "plugin_ai_instructions" (
"id" serial PRIMARY KEY NOT NULL,
"schema_path" varchar,
"field_type" "enum_plugin_ai_instructions_field_type" DEFAULT 'text',
"relation_to" varchar,
"model_id" "enum_plugin_ai_instructions_model_id",
"disabled" boolean DEFAULT false,
"prompt" varchar,
"system" varchar DEFAULT 'INSTRUCTIONS:
You are a highly skilled and professional blog writer,
renowned for crafting engaging and well-organized articles.
When given a title, you meticulously create blogs that are not only
informative and accurate but also captivating and beautifully structured.',
"layout" varchar DEFAULT '[paragraph] - Write a concise introduction (2-3 sentences) that outlines the main topic.
[horizontalrule] - Insert a horizontal rule to separate the introduction from the main content.
[list] - Create a list with 3-5 items. Each list item should contain:
a. [heading] - A brief, descriptive heading (up to 5 words)
b. [paragraph] - A short explanation or elaboration (1-2 sentences)
[horizontalrule] - Insert another horizontal rule to separate the main content from the conclusion.
[paragraph] - Compose a brief conclusion (2-3 sentences) summarizing the key points.
[quote] - Include a relevant quote from a famous person, directly related to the topic. Format: "Quote text." - Author Name',
"unsloth_text_settings_model" varchar DEFAULT 'unsloth/gemma-4-E4B-it-qat-GGUF',
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
);
ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "plugin_ai_instructions_id" integer;
ALTER TABLE "plugin_ai_instructions_images" ADD CONSTRAINT "plugin_ai_instructions_images_image_id_media_id_fk" FOREIGN KEY ("image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "plugin_ai_instructions_images" ADD CONSTRAINT "plugin_ai_instructions_images_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."plugin_ai_instructions"("id") ON DELETE cascade ON UPDATE no action;
CREATE INDEX "plugin_ai_instructions_images_order_idx" ON "plugin_ai_instructions_images" USING btree ("_order");
CREATE INDEX "plugin_ai_instructions_images_parent_id_idx" ON "plugin_ai_instructions_images" USING btree ("_parent_id");
CREATE INDEX "plugin_ai_instructions_images_image_idx" ON "plugin_ai_instructions_images" USING btree ("image_id");
CREATE UNIQUE INDEX "plugin_ai_instructions_schema_path_idx" ON "plugin_ai_instructions" USING btree ("schema_path");
CREATE INDEX "plugin_ai_instructions_updated_at_idx" ON "plugin_ai_instructions" USING btree ("updated_at");
CREATE INDEX "plugin_ai_instructions_created_at_idx" ON "plugin_ai_instructions" USING btree ("created_at");
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_plugin_ai_instructions_fk" FOREIGN KEY ("plugin_ai_instructions_id") REFERENCES "public"."plugin_ai_instructions"("id") ON DELETE cascade ON UPDATE no action;
CREATE INDEX "payload_locked_documents_rels_plugin_ai_instructions_id_idx" ON "payload_locked_documents_rels" USING btree ("plugin_ai_instructions_id");`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "plugin_ai_instructions_images" DISABLE ROW LEVEL SECURITY;
ALTER TABLE "plugin_ai_instructions" DISABLE ROW LEVEL SECURITY;
DROP TABLE "plugin_ai_instructions_images" CASCADE;
DROP TABLE "plugin_ai_instructions" CASCADE;
ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_plugin_ai_instructions_fk";
DROP INDEX "payload_locked_documents_rels_plugin_ai_instructions_id_idx";
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "plugin_ai_instructions_id";
DROP TYPE "public"."enum_plugin_ai_instructions_field_type";
DROP TYPE "public"."enum_plugin_ai_instructions_model_id";`)
}

View file

@ -1,49 +1,13 @@
import * as migration_20260817_053752 from "./20260817_053752"; import * as migration_20260109_065519 from './_archived/20260109_065519';
import * as migration_20260816_213455 from './_archived/20260816_213455';
import * as migration_20260816_220000 from './_archived/20260816_220000';
import * as migration_20260817_053752 from './_archived/20260817_053752';
import * as migration_20260818_024510 from './20260818_024510';
export const migrations = [ export const migrations = [
/*{
up: migration_20251206_065831.up,
down: migration_20251206_065831.down,
name: '20251206_065831',
},
{ {
up: migration_20251212_183607.up, up: migration_20260818_024510.up,
down: migration_20251212_183607.down, down: migration_20260818_024510.down,
name: '20251212_183607', name: '20260818_024510'
},
{
up: migration_20251219_061127.up,
down: migration_20251219_061127.down,
name: '20251219_061127',
},
{
up: migration_20251222_200320.up,
down: migration_20251222_200320.down,
name: '20251222_200320',
},
{
up: migration_20251223_055859.up,
down: migration_20251223_055859.down,
name: '20251223_055859',
},*/
// {
// up: migration_20260109_065519.up,
// down: migration_20260109_065519.down,
// name: "20260109_065519",
// },
// {
// up: migration_20260816_213455.up,
// down: migration_20260816_213455.down,
// name: "20260816_213455",
// },
// {
// up: migration_20260816_220000.up,
// down: migration_20260816_220000.down,
// name: "20260816_220000",
// },
{
up: migration_20260817_053752.up,
down: migration_20260817_053752.down,
name: "20260817_053752",
}, },
]; ];