Motivation
The test-fixture mechanism currently called "migrations" is duplicated wholesale across cphalcon and phalcon, and the artifact it produces is already consumed by talon - but produced outside it. The contract sits on the wrong side of the boundary.
Current-state facts
The duplication
tests/support/Migrations/ holds 39 files in each project, byte-for-byte identical between cphalcon and phalcon.
bin/generate-db-schemas.php (103 lines) is duplicated in both.
AbstractMigration.php is 213 lines.
- 29 of the 39 classes define
insert().
The split seam
Talon already owns the entire consumption side:
Settings::get('dump_file') src/Settings.php:177
-> DatabaseTrait src/Traits/DatabaseTrait.php:67
-> Connection::loadSchema($file) src/Database/Connection.php:79
-> StatementSplitter::split() src/Database/StatementSplitter.php
-> exec
dump_file is set per driver in resources/phpunit.{mysql,mariadb,pgsql,sqlite}.xml.
The producer - bin/generate-db-schemas.php - lives in cphalcon/phalcon. Talon consumes a file format it does not define.
Implementation
| Decision |
Choice |
Rationale |
| Naming |
Schema, not Migration |
These are not migrations. RollbackTestMigration tests transaction |
| Namespace |
Phalcon\Talon\Database\Schema |
Sits alongside the Database\* components it depends on. |
| What moves to talon |
Base class, generator, discovery/ordering |
Talon already owns connection, dialect, splitting and assertions. This is the missing half of an open seam. |
| What stays in the projects |
The 39 concrete classes |
They describe Phalcon's test data. Talon must stay usable by anyone. |
| Per-dialect raw SQL |
Keep |
A declarative DSL rebuilds phinx's Table API and cannot honestly express auto_increment/autoincrement/serial, pg sequences, SET FOREIGN_KEY_CHECKS=0, comment on, or tables absent from a dialect. |
| Statement lists |
list<string>, developer-ordered |
See below. |
drop in the statement list |
Removed |
See below. |
| sqlsrv |
Dropped |
Dead weight on all 39 classes; commented out in the generator; absent from Dialect. May be reintroduced later, but not expected. |
addTable() dependencies |
None - standalone only, enforced |
Caller issues a second addTable() with dependencies already satisfied. No transitive resolution. Enforced rather than documented - see the FK-strictness asymmetry below. |
| Scope ceiling |
Fixtures only |
No version numbers, no up/down, no state table, no --target. . |
Motivation
The test-fixture mechanism currently called "migrations" is duplicated wholesale across cphalcon and phalcon, and the artifact it produces is already consumed by talon - but produced outside it. The contract sits on the wrong side of the boundary.
Current-state facts
The duplication
tests/support/Migrations/holds 39 files in each project, byte-for-byte identical between cphalcon and phalcon.bin/generate-db-schemas.php(103 lines) is duplicated in both.AbstractMigration.phpis 213 lines.insert().The split seam
Talon already owns the entire consumption side:
dump_fileis set per driver inresources/phpunit.{mysql,mariadb,pgsql,sqlite}.xml.The producer -
bin/generate-db-schemas.php- lives in cphalcon/phalcon. Talon consumes a file format it does not define.Implementation
RollbackTestMigrationtests transactionPhalcon\Talon\Database\SchemaDatabase\*components it depends on.TableAPI and cannot honestly expressauto_increment/autoincrement/serial, pg sequences,SET FOREIGN_KEY_CHECKS=0,comment on, or tables absent from a dialect.list<string>, developer-ordereddropin the statement listDialect. May be reintroduced later, but not expected.addTable()dependenciesaddTable()with dependencies already satisfied. No transitive resolution. Enforced rather than documented - see the FK-strictness asymmetry below.--target. .