- node-pg-migrate + pg: baseline migration (extensions, app_meta) with working down - src/infrastructure/db fail-fast pool and typed query helper - docker-compose: postgres:16-alpine + redis:7-alpine with one-command up - table naming convention <module>_<table> documented in README - integration tests (6) against real PostgreSQL; strict identifier validation for test DDL after security-gate hardening round - deps justified in spec/tech.md; all gates approved; verify.sh green
26 lines
754 B
JavaScript
26 lines
754 B
JavaScript
/**
|
|
* Baseline migration: foundation objects only.
|
|
* Business tables arrive with their owning modules using the
|
|
* <module>_<table> naming convention.
|
|
*/
|
|
|
|
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
|
|
export const up = (pgm) => {
|
|
pgm.sql('CREATE EXTENSION IF NOT EXISTS citext');
|
|
pgm.sql('CREATE EXTENSION IF NOT EXISTS pgcrypto');
|
|
pgm.sql(`
|
|
CREATE TABLE app_meta (
|
|
key text PRIMARY KEY,
|
|
value text NOT NULL,
|
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
)
|
|
`);
|
|
};
|
|
|
|
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
|
|
export const down = (pgm) => {
|
|
pgm.sql('DROP TABLE IF EXISTS app_meta');
|
|
pgm.sql('DROP EXTENSION IF EXISTS pgcrypto');
|
|
pgm.sql('DROP EXTENSION IF EXISTS citext');
|
|
};
|