teqo-backup/src/migrations/20260725_022155_add_municipality_budget_notes.ts
Francisco Ignácio Fontoura Solla 2682078fe4 E16: Dossiê do município (pré-agenda) with print view and budgetNotes.
Composes existing loaders into a staff-only pre-visit tab, adds G11 manual emendas notes, and unlocks CSS print for 1–2 A4 pages.
2026-07-25 01:28:03 -03:00

23 lines
1,007 B
TypeScript

import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
/**
* E16 dossiê — staff-only `municipality.budgetNotes` (emendas aportadas,
* manual-first per gap G11).
*
* The generated diff also wanted to CREATE TABLE "campaign_goals": that table
* was added by the hand-written `20260724_180000_add_campaign_goals_global`
* (which shipped without a drizzle snapshot), so the differ's "before" state
* did not know it. The statement was removed here — the table already exists
* everywhere that migration ran — while this migration's committed `.json`
* snapshot now includes `campaign_goals`, healing the snapshot chain for
* future generated migrations.
*/
export async function up({ db }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "municipality" ADD COLUMN "budget_notes" varchar;`)
}
export async function down({ db }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "municipality" DROP COLUMN "budget_notes";`)
}