Example #1
0
 /**
  * Single purge step that reverts any included and installed migrations
  *
  * @param mixed $old_state State returned by previous call of this method
  * @return false Indicates no further steps are required
  */
 public function purge_step($old_state)
 {
     $migrations = $this->get_migration_file_list();
     $this->migrator->set_migrations($migrations);
     foreach ($migrations as $migration) {
         while ($this->migrator->migration_state($migration) !== false) {
             $this->migrator->revert($migration);
             return true;
         }
     }
     return false;
 }
Example #2
0
 protected function load_migrations()
 {
     $migrations = $this->extension_manager->get_finder()->core_path('src/db/migration/data/')->extension_directory('/migrations')->get_classes();
     $this->migrator->set_migrations($migrations);
 }
Example #3
0
 /**
  * Populate migrations for the installation
  *
  * This "installs" all migrations from (root path)/src/db/migrations/data.
  * "installs" means it adds all migrations to the migrations table, but does not
  * perform any of the actions in the migrations.
  *
  * @param \src\extension\manager $extension_manager
  * @param \src\db\migrator $migrator
  */
 function populate_migrations($extension_manager, $migrator)
 {
     $finder = $extension_manager->get_finder();
     $migrations = $finder->core_path('src/db/migration/data/')->get_classes();
     $migrator->populate_migrations($migrations);
 }