src/Ace/Commands/Migrations/MigrationStatusCommand.php
/**
	 * Draws the given migration array to the output in a table.
	 *
	 * @param OutputInterface $out
	 * @param Migration[] $migrations
	 * @return void
	 */
Draws the given migration array to the output in a table.
@param OutputInterface $out
@param Migration[] $migrations
@return void
Draws the given migration array to the output in a table . @param OutputInterface $out @param Migration [] $migrations @return void
public function showMigrations(OutputInterface $out, array $migrations) {
		$table = new AsciiTable();
		$table->cellSpacing = 4;
		$table->addColumn('id');
		$table->addColumn('migration');
		$table->addColumn('batch');
		$table->addColumn('status');
		$table->addColumn('time', 12);
		$nextMigrationId = 1;
		$nextBatchId = 1;
		foreach ($migrations as $migration) {
			$id = $migration->getRecordId();
			$name = $migration->getRecordName();
			$batchId = $migration->getBatchId();
			$status = $migration->isPending() ? '<fg=yellow>✖  pending</>' : '<fg=green>✔  finished</>';
			$time = $this->getMigrationTimestamp($migration);
			if ($migration->isFinished()) {
				$nextMigrationId = max($nextMigrationId, $id + 1);
				$nextBatchId = max($nextBatchId, $batchId + 1);
			}
			else {
				$id = $nextMigrationId++;
				$batchId = $nextBatchId;
			}
			$table->addRow([
				$id,
				$name,
				$batchId,
				$status,
				$time
			]);
		}
		$table->render($out);
	}
public function showMigrations ( OutputInterface $ out , array $ migrations ) { $ table = new AsciiTable ( ) ; $ table -> cellSpacing = 4 ; $ table -> addColumn ( 'id' ) ; $ table -> addColumn ( 'migration' ) ; $ table -> addColumn ( 'batch' ) ; $ table -> addColumn ( 'status' ) ; $ table -> addColumn ( 'time' , 12 ) ; $ nextMigrationId = 1 ; $ nextBatchId = 1 ; foreach ( $ migrations as $ migration ) { $ id = $ migration -> getRecordId ( ) ; $ name = $ migration -> getRecordName ( ) ; $ batchId = $ migration -> getBatchId ( ) ; $ status = $ migration -> isPending ( ) ? '<fg=yellow>✖  pending</>' : ' fg=green>✔  finished</>'; $ time = $ this -> getMigrationTimestamp ( $ migration ) ; if ( $ migration -> isFinished ( ) ) { $ nextMigrationId = max ( $ nextMigrationId , $ id + 1 ) ; $ nextBatchId = max ( $ nextBatchId , $ batchId + 1 ) ; } else { $ id = $ nextMigrationId ++ ; $ batchId = $ nextBatchId ; } $ table -> addRow ( [ $ id , $ name , $ batchId , $ status , $ time ] ) ; } $ table -> render ( $ out ) ; }
Draws the given migration array to the output in a table.
Draws the given migration array to the output in a table .