# Phase 5 — Schema lifecycle status

## Implemented

- Phinx configuration and dev dependency are prepared.
- `database/phinx/` is the only location for new Phinx migrations.
- `MigrationArchitectureTest` guards duplicate legacy prefixes and requires `up()`/`down()` for every Phinx migration.
- `tools/migration-prefix-check.php` is a CI-safe duplicate-prefix guard.
- `tools/schema-drift.php` is read-only and fails closed when the reference schema is missing/empty.
- Existing legacy migration files remain immutable; they are not silently rewritten or renamed.

## Blocking fact discovered in the supplied snapshot

`database/schema_dump.sql` currently contains only 23 `CREATE TABLE` definitions, while the project history in `docs/arch/PROGRESS.md` states that the production/reference schema contains materially more objects (including views/triggers and a 104-table production census). Therefore it is not safe to manufacture the missing schema objects or claim zero drift from this snapshot.

The correct next operation is to export a complete authoritative schema from the intended reference database, including tables, columns, indexes, foreign keys, views and triggers. Replace `database/schema_dump.sql` with that complete dump, then run:

```bash
php tools/schema-drift.php --database=anbt_test
php tools/migration-prefix-check.php
vendor/bin/phpunit --testsuite architecture
vendor/bin/phinx status -e testing
```

Do **not** run the baseline migration on an empty database until the reference dump is complete. The baseline migration intentionally fails closed to prevent a false claim of reproducibility.
