{ "enabled": true, "name": "Verify Migration (PostgreSQL)", "description": "When a migration file is created or edited in backend/migrations/, verifies it follows the project's PostgreSQL migration patterns: uses pool.query(), parameterized queries, IF NOT EXISTS, proper error handling, and matches the async/await style of existing migrations.", "version": "1", "when": { "type": "fileCreated", "patterns": [ "backend/migrations/*.js" ] }, "then": { "type": "askAgent", "prompt": "A migration file was just created or edited. Review it against the existing PostgreSQL migrations in backend/migrations/ and verify:\n\n1. Imports pool from '../db' (not sqlite3)\n2. Uses async/await with pool.query() (not callback-based db.run())\n3. Uses CREATE TABLE IF NOT EXISTS / ALTER TABLE with IF NOT EXISTS guards where possible\n4. Uses PostgreSQL types (TEXT, INTEGER, NUMERIC, TIMESTAMPTZ, BOOLEAN, JSONB) not SQLite types (REAL, DATETIME)\n5. Wraps multiple DDL statements in a transaction (BEGIN / COMMIT) via pool.query\n6. Adds appropriate indexes for foreign keys and frequently queried columns\n7. Includes try/catch error handling with process.exit(1) on failure\n8. Ends with pool.end() after completion\n9. Has a self-executing async main function pattern matching existing migrations\n\nCompare against recent migrations like add_vcl_reporting_columns.js or add_finding_archive_tables.js for style reference. Report any deviations." } }