Generates a Route B move migration that relocates mailglass's four core tables
from public into a dedicated mailglass schema — the recommended upgrade path
for adopters running the 1.x public install who are moving to mailglass 2.0.
The emitted migration is metadata-only and transactional:
SET LOCAL lock_timeout = '5s'so the move fails fast (SQLSTATE55P03) rather than queueing behind a long reader holdingACCESS EXCLUSIVE— retrymix ecto.migrateoff-peak.CREATE SCHEMA IF NOT EXISTS "mailglass", thenALTER TABLE public.<t> SET SCHEMA "mailglass"for all four core tables (indexes, constraints, and sequences move with each table; the table comment survives the OID move).- the append-only immutability function does NOT move with the table (it is a
distinct
pg_procobject), so the migration drops and recreates it schema-qualified — byte-parity with the shipped fresh-install DDL, so a moved database is indistinguishable from a freshly-installed one.
A working down/0 reverses the move: it returns all four tables to public and
restores the public-qualified function and trigger.
The task is idempotent — re-running it prints unchanged <path> and does not
emit a second migration.
mix mailglass.upgrade.v2_schemaOptions:
--schema <name>— target schema (defaultmailglass). Validated as a Postgres unquoted identifier before it is interpolated into the migration.
Summary
Functions
Returns the move-migration source for app_module as a string.
Functions
Returns the move-migration source for app_module as a string.
Exposed so tests can assert the emitted body without a full filesystem run.
Accepts :schema (default "mailglass"); the value is assumed pre-validated
by run/1 via Mailglass.Identifier.validate!/2.