Delete migration file if options is set

@param string $migration

@return null
1773
protected function deleteIfNeeded($migration)
    {
        if (!$this->input->getOption('delete')) {
            return;
        }

        if ($this->migrator->deleteMigrationFile($migration)) {
            $this->message("<info>Deleted:</info> {$migration}.php");
        }
    }
616445
private function _processMigration(Migration $migration, callable $command)
    {
        if ($migration->isTransaction()) {
            $this->getDbRepository()->getAdapter()->transaction($command);
        } else {
            if ($this->logger) {
                $this->logger->alert('NO TRANSACTION!');
            }
            $command();
        }
    }
408115
public function setMigrationClassName($fileName = null)
    {
        if ($this->getFileExt($this->latestFile) !== 'php') {
            throw new \Exception(APP_NS.'/Resources/Database/Migrations/ must have {xxxx_table_name.php} file types');
        }

        $fileName = (is_null($fileName)) ? $this->latestFile : $fileName;

        $file = str_replace(EXT, '', $fileName);
        $exp = '';
        $exp = preg_split('((\d+|\D+))', $file, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);

        $this->migrationVersion = $exp[0];
        $this->migrationClass = $exp[1];
    }
858738
public function delete($file = null)
	{
		$file = $file ?: $this->file;
		if ($this->fs->exists($file))
			$this->fs->delete($file);
		if ($this->f3->get('CACHE')) {
			$cache = \Cache::instance();
			if($cache->exists($cacheHash = $this->getCacheHash($file)))
				$cache->clear($cacheHash);
		}
		$this->metaHandle->delete($file);
	}
886958
private function removeMigration(Connection $connection, int $index): void
    {
        $connection->delete(static::MIGRATIONS_TABLE, [static::MIGRATIONS_COLUMN_ID => $index]);
    }
1233948
public function runSingleMigration($migration)
	{
		require_once $migration->path;
		$migrationClass = $migration->class_name;
		
		if (!class_exists($migrationClass)) {
			throw new MigrationClassNotFoundException(
				sprintf(
					'Migration class [%s] does not exist',
					$migrationClass
				)
			);
		}

		$class = new $migrationClass();

		if (Migration::migrationType() == Attribute::DOWNGRADE) {
			$class->down();
		}else{
			$class->up();
		}

		$migration = Model::findById($migration->id);
		$migration->status = 'migrated';
		$migration->save();

		$this->env->sendOutput(
			sprintf(
				'[%s] migration was successful',
				$migration->class_name
			),
			'green'
		);
	}
152373
public function executeMigrations($file, $migrations)
    {
        foreach ($migrations as $index => $migration) {
            $migration = $this->keepBcForOldMigrationQueryFormat($index, $migration);
            $this->executeMigration($file, $migration);
        }
    }
101525
public function remove($migrationData, array $fields)
    {
        $migrationData['method'] = 'table';

        $compiled = $this->compiler->compile($this->getTemplate(), $migrationData);

        return $this->replaceFieldsWith($this->dropColumns($fields), $compiled);
    }
954061
private function makeUp($current_migrations, $migrations)
    {
        if (count($current_migrations) == count($migrations)) {
            echo Color::green('Nothing to migrate.');
            
            return;
        }

        foreach ($migrations as $file => $migration) {
            if ($this->checkMigrationExistance($migration)) {
                continue;
            }

            // Include the migration file
            require $file;

            try {
                // Up migration
                (new $migration)->up();
            } catch (\Exception $exception) {
                $this->throwMigrationException($exception, $migration);
            }

            // Create new migration status
            $this->createMigrationStatus($migration);
        }

        foreach ($current_migrations as $migration) {
            $this->updateMigrationStatus(
                $migration->migration,
                $migration->batch + 1
            );
        }
    }
801922
private function handleOptionalMigrationOption()
    {
        if ($this->option('migration') === true) {
            $migrationName = 'create_' . $this->createMigrationName() . '_table';
            $this->call('module:make-migration', ['name' => $migrationName, 'module' => $this->argument('module')]);
        }
    }
511691
public function migrateCleanup($opts = ['migrations' => '']) {
    if ($opts['migrations'] && ($this->migrationSourceFolder() || $this->usesMigrationPlugins)) {
      $migrations = explode(',', $opts['migrations']);
      $project_properties = $this->getProjectProperties();

      foreach ($migrations as $migration) {
        $this->taskExec('drush mrs ' . $migration)
          ->dir($project_properties['web_root'])
          ->run();
      }
    }
    if ($this->migrationSourceFolder()) {
      $this->taskExec('drush mr --all && drush cim --partial --source=' . $this->migrationSourceFolder() . ' -y && drush ms')
        ->dir($project_properties['web_root'])
        ->run();
    }
    else if ($this->usesMigrationPlugins) {
      $this->taskExec('drush cr && drush mr --all && drush ms')
        ->dir($project_properties['web_root'])
        ->run();
    }
    else {
      $this->say('No migration sources configured.');
      $this->say('To use this command, you must either return a folder path from the migrationSourceFolder() method or set $usesMigrationPlugins to TRUE in your project\'s RoboFile.php.');
      return FALSE;
    }
  }
127083
public function delete($criteria=NULL)
    {
        $where = !is_null($criteria)
            ? 'WHERE '.$criteria->toSql()
            : NULL
            ;

        return $this->_connection->execute(sprintf(
            'DELETE FROM %s %s',
            $this->_name->quoted(),
            $where
            ));
    }
1024308
public function down()
    {
        Schema::drop('ab_experiments');
        Schema::drop('ab_events');
        Schema::drop('ab_instance');
        Schema::drop('ab_goal');

        \DB::connection()->getPdo()->exec("delete from migrations where migration = '2015_08_15_000001_create_ab_tables'");
        return true;
    }
1321267
protected function saveMigrationFile(string $filePath, string $migration): void
    {
        $this->output->writeln(sprintf('Generate migration file: %s', $filePath));
        file_put_contents($filePath, $migration);
    }
563559
protected function deleteMigrations(array $migrations)
	{
		if ( !$migrations ) {
			return;
		}

		$sql = 'DELETE FROM Migrations
				WHERE Name IN (:names)';
		$this->_context->getDatabase()->perform($sql, array('names' => $migrations));
	}
1154022
private function executeRollBacks(array $migrations) : void
    {
        $this->connection->beginTransaction();

        foreach ($migrations as $migration) {
            $migration->down();
            $this->executedMigrations->delete(get_class($migration));
        }

        $this->connection->commit();
    }
449804
protected function runDown($file, $migration, $pretend)
    {
        // First we will get the file name of the migration so we can resolve out an
        // instance of the migration. Once we get an instance we can either run a
        // pretend execution of the migration or we can run the real migration.
        $instance = $this->resolve(
            $name = $this->getMigrationName($file)
        );

        $this->note("<comment>Rolling back:</comment> {$name}");

        if ($pretend) {
            return $this->pretendToRun($instance, 'down');
        }

        $this->runMigration($instance, 'down');

        // Once we have successfully run the migration "down" we will remove it from
        // the migration repository so it will be considered to have not been run
        // by the application then will be able to fire by any later operation.
        $this->repository->delete($migration);

        $this->note("<info>Rolled back:</info>  {$name}");
    }