Get list of migration executed.

@return Collection
428312
protected function executedMigrations()
    {
        $result = [];
        foreach ($this->getRepository()->get() as $row) {
            $result[] = $row['migration'];
        }

        return $result;
    }
67125
public function getAppliedMigrations( )
    {
        $query = "SELECT * FROM $this->migrationTable";
        
        $applied = $this->db->query( $query );
        
        $list = array();
        
        foreach( $applied as $mig )
        {
            $list[] = $mig[ 'migration_name' ];
        }
        
        $list = array_reverse( $list );
        
        return $this->filter( self::ON_GET_APPLIED_MIGRATIONS_FILTER, $list );
    }
678690
public function getMigrationsLocations()
    {
        $migrationsLocations = [];
        foreach ($this->kernel->getBundles() as $bundle) {
            $migrationsLocation = $this->createMigrationsLocation($bundle);
            if ($this->filesystem->exists($migrationsLocation->getDirectory())) {
                $migrationsLocations[] = $migrationsLocation;
            }
        }

        return $migrationsLocations;
    }
513900
def get_unregistered_migrations(self):
        """"""
        return [m for m in self.get_migration_files()
                if not self.collection.find_one({'filename': m.filename})]
156138
public function getMigrationStatus()
    {
        $configuration = $this->getMigrationConfiguration();

        $executedMigrations = $configuration->getMigratedVersions();
        $availableMigrations = $configuration->getAvailableVersions();
        $executedUnavailableMigrations = array_diff($executedMigrations, $availableMigrations);

        $numExecutedUnavailableMigrations = count($executedUnavailableMigrations);
        $numNewMigrations = count(array_diff($availableMigrations, $executedMigrations));

        return [
            'Name' => $configuration->getName() ? $configuration->getName() : 'Doctrine Database Migrations',
            'Database Driver' => $configuration->getConnection()->getDriver()->getName(),
            'Database Name' => $configuration->getConnection()->getDatabase(),
            'Configuration Source' => 'manually configured',
            'Version Table Name' => $configuration->getMigrationsTableName(),
            'Version Column Name' => $configuration->getMigrationsColumnName(),
            'Migrations Namespace' => $configuration->getMigrationsNamespace(),
            'Migrations Target Directory' => $configuration->getMigrationsDirectory(),
            'Previous Version' => $this->getFormattedVersionAlias('prev', $configuration),
            'Current Version' => $this->getFormattedVersionAlias('current', $configuration),
            'Next Version' => $this->getFormattedVersionAlias('next', $configuration),
            'Latest Version' => $this->getFormattedVersionAlias('latest', $configuration),
            'Executed Migrations' => count($executedMigrations),
            'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations,
            'Available Migrations' => count($availableMigrations),
            'New Migrations' => $numNewMigrations,
        ];
    }
856703
public function migrate(): array
    {
        $result = $this->getFactory()->createPropelCommandProvider()->execute('migration:diff');
        return array_merge(
            $result,
            $this->getFactory()->createPropelCommandProvider()->execute('migration:migrate')
        );
    }
765486
protected function getMigrationFiles()
    {
        if ($this->_migrationFiles === null) {
            $this->_migrationFiles = [];
            $directories = $this->getDirectories();

            foreach ($directories as $namespace => $dir) {
                if ($dir && is_dir($dir)) {
                    $handle = opendir($dir);
                    while (($file = readdir($handle)) !== false) {
                        if ($file === '.' || $file === '..') {
                            continue;
                        }
                        $path = $dir . DIRECTORY_SEPARATOR . $file;
                        if (preg_match('/^(m(\d{6}_?\d{6})\D.*?)\.php$/is', $file, $matches) && is_file($path)) {
                            $class = (is_int($namespace) ? '' : $namespace . '\\') . $matches[1];
                            if ($this->baseMigrationClass) {
                                try {
                                    require_once $path;
                                    if (is_subclass_of($class, $this->baseMigrationClass)) {
                                        $this->_migrationFiles[$class] = $path;
                                    }
                                } catch (\Exception $exc) {
                                    echo $exc->getMessage();
                                }
                            } else {
                                $this->_migrationFiles[$class] = $path;
                            }
                        }
                    }
                    closedir($handle);
                }
            }
        }

        return $this->_migrationFiles;
    }
709451
private function getMigrationsFiles()
    {
        $migrationPath = $this->migrateManager->storagePath;
        $files = array();
        if ($handle = opendir($migrationPath)) {

            while (false !== ($entry = readdir($handle))) {

                if ($entry != "." && $entry != ".." && is_file($migrationPath . '/' . $entry)) {
                    $segments = explode('_', $entry);
                    $files[$segments[0]] = $entry;
                }
            }

            closedir($handle);

            return $files;
        }

        die (Utils::colorize("Error to open migrations storage", "FAILURE"));
    }
1199858
protected function getMigrationPaths()
    {
        // Here, we will check to see if a path option has been defined. If it has we will
        // use the path relative to the root of the installation folder so our database
        // migrations may be run for any customized path from within the application.
        if ($this->input->hasOption('path') && $this->option('path')) {
            return collect($this->option('path'))->map(function ($path) {
                return $this->laravel->basePath().'/'.$path;
            })->all();
        }

        return [$this->getMigrationPath()];
    }
1162450
public function getCollection()
    {
        $collection = trim(str_replace('\\', '_', $this->collection), '_');
        return $this->$collection()
            ->setDatabase($this->database)
            ->setTable($this->table)
            ->setModel($this->model)
            ->set($this->getRows());
    }
763429
public function all(): Collection
    {
        return DB::table('user')
            ->where('user_id', '>', 0)
            ->orderBy('real_name')
            ->get()
            ->map(User::rowMapper());
    }
1062406
protected function getNewMigrations()
    {
        $applied = [];
        foreach ($this->getMigrationHistory(-1) as $version => $time) {
            $applied[$version] = true;
        }

        $migrations = [];
        //var_dump(array_merge($this->migrationPaths, Yii::$app->migrationAliases));exit;
        foreach (array_merge($this->migrationPaths, Yii::$app->migrationAliases) as $migrationPathAlias) {
            $migrationPath = Yii::getAlias($migrationPathAlias);
            if (!is_dir($migrationPath)) {
                throw new Exception("Bad migration path {$migrationPath}!");
                continue;
            }
            $handle = opendir($migrationPath);
            while (($file = readdir($handle)) !== false) {
                if ($file === '.' || $file === '..') {
                    continue;
                }
                $path = $migrationPath . DIRECTORY_SEPARATOR . $file;
                if (preg_match('/^(m(\d{6}_\d{6})_.*?)\.php$/', $file, $matches) and is_file($path)) {
                    $migrationClassName = str_replace('/', '\\', substr($migrationPathAlias, 1)) . '\\' . $matches[1];
                    if (!isset($applied[$migrationClassName])) {
                        $key = $migrationClassName::baseClassName() . '-' . md5($migrationClassName);
                        $migrations[$key] = $migrationClassName;
                        $this->migrationsMap[$migrationClassName] = $path;
                    }
                }
            }
            closedir($handle);
        }
        ksort($migrations);

        return $migrations;
    }
954982
public function getMigrationsClasses()
    {
        $appFiles = $this->getMigrationsFiles();
        $classes = [];

        /* @var $component AppInterface */
        foreach ($appFiles as $appName => $migrationFiles) {
            $component = $this->orm->getComponent($appName);
            foreach ($migrationFiles as $migrationFile) {
                $className = ClassHelper::getClassFromFile($migrationFile);
                $foundClass = ClassHelper::classExists(
                    $className,
                    $component->getNamespace()
                );
                if (!$foundClass) {
                    throw new ClassNotFoundException(
                        sprintf(
                            'The class [ %2$s\\%1$s or \\%1$s ] '.
                            'could not be located',
                            $className,
                            $component->getNamespace()
                        )
                    );
                }
                $classes[$appName][] = $foundClass;
            }
        }

        return $classes;
    }
1342319
protected function getOutstanding(): array
	{
		$migrations = $this->getMigrationsFilteredByConnection();

		if(!empty($migrations))
		{
			foreach($this->getMigrated() as $migrated)
			{
				foreach($migrations as $key => $migration)
				{
					if($migrated->package === $migration->package && $migrated->version === $migration->version)
					{
						unset($migrations[$key]);
					}
				}
			}

			usort($migrations, function($a, $b)
			{
				return strcmp($a->version, $b->version);
			});
		}

		return $migrations;
	}
562455
public function getMigrations()
    {
        $migrations = [];

        /* @var $migrationName Migration */
        foreach ($this->getMigrationsClasses() as $appName => $classes) {
            foreach ($classes as $fileName) {
                $migrationName = $fileName;
                $migration = $migrationName::createObject($fileName);
                $migration->setAppLabel($appName);
                $this->setMigratedApps($appName);
                $migrations[$fileName] = $migration;
            }
        }

        return $migrations;
    }
284206
public function getList()
    {
        if ($this->kind === 'collection') {
            $model_class = $this->model_class;
            return $model_class::dump($this->where, $model_class::PRIMARY_KEY);
        }
        return [$this->where];
    }
196521
public function getVersions()
    {
        if (!isset($this->_versions)) {
            $versions = array();

            foreach ($this->getMethods() as $method) {
                $matches = array();

                if (preg_match('/(up)(\d+)/', $method, $matches)) {
                    $versions[] = $matches[2];
                }
            }

            $path = dirname($this->getIdentifier()->filepath);

            if (file_exists($path)) {
                if (file_exists($path.'/migrations')) {
                    $files = new DirectoryIterator($path.'/migrations');
                    foreach ($files as $file) {
                        $matches = array();
                        if (preg_match('/(\d+)\.sql/', (string) $file, $matches)) {
                            $versions[] = $matches[1];
                        } elseif (preg_match('/(\d+)\.php/', (string) $file, $matches)) {
                            $versions[] = $matches[1];
                        }
                    }
                }
            }
            sort($versions);
            $this->_versions = array_unique($versions);
            $this->_max_version = array_pop($versions);
        }

        return $this->_versions;
    }