Mark a migration as migrated.
@param  string $migrationName
10913
public function migrate($migrationName) {
		$this->createTable();
		$this->db->dal()->into('_migrations')->insert(['name'=>$migrationName, 'migrated'=>date('Y-m-d H:i:s')]);
	}
1045421
public function down()
    {
        $record = new MigrationRecord();
        if ($this->connection !== null) {
            $record->setConnection($this->connection);
        }
        $record->where('migration', $this->name)->delete();
    }
1367146
public function down(Migration $migration, $loadFromFile = false)
    {
        if ($loadFromFile) {
            $this->fileRepository->loadSql($migration);
        } else {
            $this->dbRepository->loadSql($migration);
        }

        $func = function () use ($migration) {
            $this->_processMigrationSql($migration->getDown());
            $this->dbRepository->delete($migration);
        };

        $this->_processMigration($migration, $func);
    }
663212
protected function migrateUp(MigrationInterface $migration)
    {
        echo "\nm_".$migration->getTime()." ... ";
        $migration->up();
        $this->createManager($migration->getConnection())->completeUp($migration);
        echo "OK";
    }
1109130
public function addNode($migrationName, $migrationObject)
    {
        $appName = $migrationObject->getAppLabel();
        $node = new Node($appName, $migrationName);

        // add to node store
        $this->nodes[$appName][$migrationName] = $migrationObject;

        // create family tree
        $this->nodeFamilyTree[$appName][$migrationName] = $node;
    }
890332
protected function markRolledBackWithConfirmation($migration)
    {
        $helper = $this->getHelper('question');
        $question = new ConfirmationQuestion("<error>Migration $migration was not found.\r\nDo you want to mark it as rolled back? (y/n)</error>\r\n", false);

        if (!$helper->ask($this->input, $this->output, $question)) {
            $this->abort();
        }

        $this->migrator->removeSuccessfulMigrationFromLog($migration);
    }
96525
public function add($migrationName) {
		$list = $this->getList(false);
		if(isset($list[$migrationName]))
			return;
		$list[$migrationName] = ['added'=>time()+microtime(true)];
		$this->writeMigrations($list);
	}
1045038
protected function mark($versionName, $all = false)
    {
        if (!$this->configuration->hasVersion($versionName)) {
            throw MigrationException::unknownMigrationVersion($versionName);
        }

        $version = $this->configuration->getVersion($versionName);

        if ($this->markMigrated && $this->configuration->hasVersionMigrated($version)) {
            $marked = true;
            if (!$all) {
                throw new InvalidArgumentException(sprintf('The version "%s" already exists in the version table.',
                    $version));
            }
        }

        if (!$this->markMigrated && !$this->configuration->hasVersionMigrated($version)) {
            $marked = false;
            if (!$all) {
                throw new InvalidArgumentException(sprintf('The version "%s" does not exists in the version table.',
                    $version));
            }
        }

        if (!isset($marked)) {
            $filename = $this->configuration->getNamingStrategy()->getFilename($versionName);
            if ($this->markMigrated) {
                $version->markMigrated();
                $this->info('<info>Added version to table:</info> ' . $filename);
            } else {
                $version->markNotMigrated();
                $this->info('<info>Removed version from table:</info> ' . $filename);
            }
        }
    }
1209953
public function status()
    {
        $status = $this->getStatus();
        if (!$status) {
            $this->writeln('No migrations found.');

            return;
        }

        $this->writeln(' Ran?    Name ');
        $this->writeln('--------------');

        foreach ($status as $row) {
            if ($row['migrated']) {
                $mark = $this->cli->success('Y');
            } else {
                $mark = $this->cli->error('N');
            }
            $this->writeln(' ' . $mark . '       ' . $row['id']);
        }
    }
8515
public function completeUp(MigrationInterface $migration)
    {
        $query = (new InsertQueryBuilder())->into(static::tableName())->set([
            'id' => $migration->getTime(),
            'comment' => $migration->comment(),
        ]);

        $parsed = $query->parse($this->connection->getDialect());
        $this->connection->prepare($parsed->getSql())->execute($parsed->getArguments());
    }
1030331
protected function promptMigration($name)
    {
        $this->line('');

        if ($this->confirm('Would you like to create the migration for the model? [Yes|no]'))
        {
            $this->call('transit:migration', ['table' => str_plural($name)]);
        }
    }
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();
    }
961720
public function forget($name = '')
    {

        $filePath = FacadeMigration::createName($name);
        if ($this->file->exists($filePath)) {
            $this->file->delete($filePath);
            $this->info(sprintf('%s migration succesfully removed in %s', $name, $filePath));
        } else {
            $this->error(sprintf('%s migration could not removed in %s, file not exists', $name,
                $filePath));
        }
    }
228650
protected function rollbackMigration($migration)
    {
        if ($this->migrator->doesMigrationFileExist($migration)) {
            $this->migrator->rollbackMigration($migration);
        } else {
            $this->markRolledBackWithConfirmation($migration);
        }

        $this->message("<info>Rolled back:</info> {$migration}.php");
    }
515070
public function addMigration(SQLMigration $migration) {
		if (!$migration instanceof MySQLMigration) {
			throw new InvalidMigrationType(\get_class($migration));
		}
		$this->migrations[\get_class($migration)] = $migration;
	}
681600
public function migrateDown( $levels = NULL )
    {
        if ( NULL !== $levels )
        {
            $this->levels = $levels;
        }
        
        $migrations = $this->getAppliedMigrations( );
        
        $i = 0;
        
        if ( self::MIGRATE_ALL === $this->levels || $this->levels > count( $migrations ) )
        {
            $this->levels = count( $migrations );
        }
        
        while ( $i < $this->levels )
        {
            $class = $migrations[ $i ];
            
            $migration = new $class( );
            
            $method = new \ReflectionMethod( $class, 'migrateDown' );
            
            // run migrateDown
            if ( $class === $method->getDeclaringClass( )->name )
            {
                $migration->migrateDown( $this->db );
                
                // delete migration from table
                if ( FALSE === $this->_deleteMigrationRecord( $class ) )
                {
                    throw new MigrationException( 'Failed to delete migration record: ' . $class );
                }
            }
            else // run safeMigrateDown
            {
                $method = new \ReflectionMethod( $class, 'safeMigrateDown' );
            
                if ( $class === $method->getDeclaringClass( )->name )
                {
                    try
                    {
                        // start transaction
                        $this->db->startTransaction( );

                        // turn off auto commit
                        $this->db->setTransactionAutocommit( FALSE );

                        // run safeMigrateDown
                        $migration->safeMigrateDown( $this->db );

                        // delete migration record
                        if ( FALSE === $this->_deleteMigrationRecord( $class ) )
                        {
                            throw new MigrationException( 
                                    'Failed to delete migration record: ' . $class );
                            
                            $this->db->rollbackTransaction();
                        }

                        // commit transaction
                        $this->db->commitTransaction( );
                    }
                    catch ( \Exception $e )
                    {
                        // rollback transaction
                        $this->db->rollbackTransaction( );

                        throw $e;
                    }
                }
            }
            
            $i++;
            
            if ( $this->levels === $i )
            {
                $this->doAction( self::ON_MIGRATE_DOWN_ACTION );
                
                return;
            }
        }
    }
651561
protected function migrate()
    {
        $this->console->call(
            'migrate',
            ['--scope' => $this->addon->slug(), '--force' => true],
            $this->command ? $this->command->getOutput() : null
        );
    }