Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #70 from elliottpost/patch-1
Update migration dependency checks in seed
  • Loading branch information
lcharette committed May 11, 2019
2 parents c4ddd26 + 85bd146 commit 4f77cde
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pages/12.database/04.seeding/docs.md
Expand Up @@ -157,11 +157,16 @@ public function run()
$ranMigrations = $migrator->getRepository()->getMigrationsList();

// The migration we require
$groupMigration = '\UserFrosting\Sprinkle\Account\Database\Migrations\v400\GroupsTable';

// Make sure required migration is in the ran list. Throw exception if it isn't.
if (!in_array($groupMigration, $ranMigrations)) {
throw new \Exception("Migration `$groupMigration` doesn't appear to have been run!");
$groupMigrations = [
'\UserFrosting\Sprinkle\Account\Database\Migrations\v400\ActivitiesTable',
'\UserFrosting\Sprinkle\Account\Database\Migrations\v400\GroupsTable'
];

foreach ($groupMigrations as $groupMigration) {
// Make sure required migration is in the ran list. Throw exception if it isn't.
if (!in_array($groupMigration, $ranMigrations)) {
throw new \Exception("Migration `$groupMigration` doesn't appear to have been run!");
}
}

// Execute group seed...
Expand Down

0 comments on commit 4f77cde

Please sign in to comment.