runDowngrade() public method

Run downgrade scripts.
public runDowngrade ( Connection $conn, BaseDriver $driver, array $scripts = null, $steps = 1 )
$conn LazyRecord\Connection
$driver SQLBuilder\Driver\BaseDriver
$scripts array
コード例 #1
0
 public function execute()
 {
     $dsId = $this->getCurrentDataSourceId();
     $runner = new MigrationRunner($dsId);
     $runner->load($this->options->{'script-dir'} ?: 'db/migrations');
     $this->logger->info('Running migration scripts to downgrade...');
     $runner->runDowngrade();
     $this->logger->info('Done.');
 }
コード例 #2
0
 public function execute()
 {
     $connection = $this->getCurrentConnection();
     $driver = $this->getCurrentQueryDriver();
     if ($this->options->backup) {
         if (!$driver instanceof PDOMySQLDriver) {
             $this->logger->error('backup is only supported for MySQL');
             return false;
         }
         $this->logger->info('Backing up database...');
         $backup = new MySQLBackup();
         if ($dbname = $backup->incrementalBackup($connection)) {
             $this->logger->info("Backup at {$dbname}");
         }
     }
     $dsId = $this->getCurrentDataSourceId();
     $runner = new MigrationRunner($this->logger, $dsId);
     $runner->load($this->options->{'script-dir'} ?: 'db/migrations');
     $this->logger->info("Performing downgrade over data source: {$dsId}...");
     $runner->runDowngrade($connection, $driver);
     $this->logger->info('Done.');
 }