Possibility to use migrations in parallel feature branches #777

Open
wants to merge 3 commits into from

4 participants

@javer

During executing migrations store not only the latest migration timestamp, but all timestamps of executed migrations. It allows to execute all migrations after merging two or more feature branches with migrations which were developed at the same time.

Before use you should import into propel_migration table timestamps of all already executed migrations.

New migration system is disabled by default and can be enabled using option:

propel.migration.parallel = true
@jaugustin jaugustin commented on an outdated diff Oct 16, 2013
generator/lib/util/PropelMigrationManager.php
@@ -222,12 +285,17 @@ public function getMigrationTimestamps()
public function getValidMigrationTimestamps()
{
- $oldestMigrationTimestamp = $this->getOldestDatabaseVersion();
- $migrationTimestamps = $this->getMigrationTimestamps();
- // removing already executed migrations
- foreach ($migrationTimestamps as $key => $timestamp) {
- if ($timestamp <= $oldestMigrationTimestamp) {
- unset($migrationTimestamps[$key]);
+ if ($this->getMigrationParallel()) {
+ $migrationTimestamps = array_diff($this->getMigrationTimestamps(), $this->getAllDatabaseVersions());
+ }
+ else {
@jaugustin
Propel member

should be on the same line as closing bracket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@willdurand
Propel member

@jaugustin Good to go?

@jaugustin
Propel member

@willdurand I didn't test it, I only did a fast code review :)

@staabm
Propel member

@javer Could you please add unit tests?

@staabm
Propel member

@javer any news here? may you provide some tests for it?

@javer

@staabm, can you give me some examples of how to test this complex process, which require live database and when behavior depends on migration table content? I don't see any tests for migration process or any other task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment