public function getList($db=true) {
		if(!file_exists($this->dir.'/migrations.json'))
			return [];
		$migrations = json_decode(file_get_contents($this->dir.'/migrations.json'), true);

		if($db) {
			$tracking = [];

			$this->createTable();
			foreach($this->db->dal()->from('_migrations')->get() as $r)
				$tracking[$r['name']] = ['migrated' => strtotime($r['migrated'])];

			foreach($migrations as $migration=>$params) {
				if(isset($tracking[$migration]))
					$migrations[$migration] = array_merge($migrations[$migration], $tracking[$migration]);
			}
		}

		uasort($migrations, function($a, $b) {
			if(isset($a['migrated']) && !isset($b['migrated']))
				return -1;
			elseif(!isset($a['migrated']) && isset($b['migrated']))
				return 1;
			elseif(isset($a['migrated']) && isset($b['migrated'])) {
				if($a['migrated'] !== $b['migrated'])
					return $a['migrated'] > $b['migrated'];
			}
			return $a['added'] > $b['added'];
		});
		
		return $migrations;
	}
public function getList($db=true) {
		if(!file_exists($this->dir.'/migrations.json'))
			return [];
		$migrations = json_decode(file_get_contents($this->dir.'/migrations.json'), true);

		if($db) {
			$tracking = [];

			$this->createTable();
			foreach($this->db->dal()->from('_migrations')->get() as $r)
				$tracking[$r['name']] = ['migrated' => strtotime($r['migrated'])];

			foreach($migrations as $migration=>$params) {
				if(isset($tracking[$migration]))
					$migrations[$migration] = array_merge($migrations[$migration], $tracking[$migration]);
			}
		}

		uasort($migrations, function($a, $b) {
			if(isset($a['migrated']) && !isset($b['migrated']))
				return -1;
			elseif(!isset($a['migrated']) && isset($b['migrated']))
				return 1;
			elseif(isset($a['migrated']) && isset($b['migrated'])) {
				if($a['migrated'] !== $b['migrated'])
					return $a['migrated'] > $b['migrated'];
			}
			return $a['added'] > $b['added'];
		});
		
		return $migrations;
	}
public function getList ( $ db = true ) { if ( ! file_exists ( $ this -> dir . '/migrations.json' ) ) return [ ] ; $ migrations = json_decode ( file_get_contents ( $ this -> dir . '/migrations.json' ) , true ) ; if ( $ db ) { $ tracking = [ ] ; $ this -> createTable ( ) ; foreach ( $ this -> db -> dal ( ) -> from ( '_migrations' ) -> get ( ) as $ r ) $ tracking [ $ r [ 'name' ] ] = [ 'migrated' => strtotime ( $ r [ 'migrated' ] ) ] ; foreach ( $ migrations as $ migration => $ params ) { if ( isset ( $ tracking [ $ migration ] ) ) $ migrations [ $ migration ] = array_merge ( $ migrations [ $ migration ] , $ tracking [ $ migration ] ) ; } } uasort ( $ migrations , function ( $ a , $ b ) { if ( isset ( $ a [ 'migrated' ] ) && ! isset ( $ b [ 'migrated' ] ) ) return - 1 ; elseif ( ! isset ( $ a [ 'migrated' ] ) && isset ( $ b [ 'migrated' ] ) ) return 1 ; elseif ( isset ( $ a [ 'migrated' ] ) && isset ( $ b [ 'migrated' ] ) ) { if ( $ a [ 'migrated' ] !== $ b [ 'migrated' ] ) return $ a [ 'migrated' ] > $ b [ 'migrated' ] ; } return $ a [ 'added' ] > $ b [ 'added' ] ; } ) ; return $ migrations ; }
Return the list of registered migratins.
@param  $db   Fetch the database information.
@return array
Return the list of registered migratins .