# Automated migration acceptance

Existing format-1 SQL files are immutable. Core Goose execution remains available
while the installable evolves. Check items only with implementation and test evidence.

## Discovery and query generation
- [x] Generate deterministic explicit registries from opted-in model declarations in `models.go` and `models/*.go` using Go package analysis.
- [x] Honor build tags, exclude helper structs and tests, diagnose stale registries, and run without a database.
- [x] Keep explicit registration available and scope discovery to explicitly selected app packages.
- [x] Verify optional GORM GEN against GORM v1.31.2, reproducible output and compiled queries against a real database in a separate consumer.

## PostgreSQL schema
- [x] Require explicit source/target rename declarations; reject undeclared removals and conversions before writing files.
- [x] Test column/table removal, type/null/default transitions, backfills, index/constraint changes and relationship/key variants.
- [x] Version PostgreSQL capabilities and schema rendering; reject unsupported operations before execution.
- [x] Test PostgreSQL schema operations and data preservation against a real server.
- [x] Test PostgreSQL concurrent-index partial failure, explicit repair and safe retry; reject other nontransactional SQL.

## History and execution
- [x] Retain format-1 fixtures byte-for-byte and verify append-only format upgrades.
- [x] Resolve cross-app version dependencies deterministically; reject missing dependencies, cycles and branch conflicts.
- [x] Test explicit merge migrations and historical state independently of current Go models.
- [x] Test squash/replacement from fresh and every partially applied replaced history.
- [x] Expose inspection, SQL preview, execution plans, target application and rollback.
- [x] Test locking, concurrent runners, checksum mismatches, missing applied files, failures, retries and irreversible/data-loss guards.
- [x] Support explicit data SQL and handwritten schema transitions with declared historical states.
- [x] Verify baseline/adoption against actual schema; detect drift without rewriting history or pretending SQL ran.

## Delivery
- [x] Supply runnable lifecycle example with initial generation/application, rename, backfill, data migration, cross-app dependency, rollback and recovery.
- [x] Integrate generated project/app workflow without changing runtime ORM or invoking AutoMigrate.
- [x] Run nested-module unit, integration, race and PostgreSQL conformance tests explicitly in CI.
- [x] Verify independent consumer installation and document exact tested versions and upgrade limitations.

## Evidence and scope

The generated separate consumer verifies local module/tool installation, split
model packages, related models, embedded history, initial and upgraded prefixes,
rename/backfill, status and retained rows after registration removal. The lifecycle
example additionally verifies cross-app dependencies, rollback, data SQL and
transactional/nontransactional recovery. Both run against PostgreSQL in CI.

See [the verification record](https://cicadel.fauzaanu.com/en/dev/sources/docs/automated-migrations-progress.md) for the
final checks. Installation uses local replacements; no public release/tag is
claimed. Supported storage/operation boundaries are documented in the README.
