src/Ace/Commands/Migrations/MigrationFreshCommand.php
/**
	 * Drops all tables in all registered databases. Dangerous...
	 *
	 * @return void
	 */
Drops all tables in all registered databases. Dangerous
@return void
Drops all tables in all registered databases . Dangerous @return void
protected function clearTables(OutputInterface $out) {
		$numTables = 0;
		foreach (Application::kernel()->database()->getConnections() as $connectionName => $connection) {
			$database = $connection->getDatabase()->getDatabaseName();
			$rows = $connection->query('SHOW TABLES');
			$connection->query('SET FOREIGN_KEY_CHECKS = 0;');
			foreach ($rows as $row) {
				$numTables++;
				$tableName = array_values((array) $row)[0];
				$out->writeln(sprintf(
					'<fg=yellow>[ᐅ]</> [%s] %s.%s',
					$connectionName,
					$database,
					$tableName
				));
				$connection->query('DROP TABLE IF EXISTS `' . $tableName . '`;');
			}
			$connection->query('SET FOREIGN_KEY_CHECKS = 1;');
		}
		$out->writeln('<fg=green>[✓]</> dropped tables');
	}
protected function clearTables ( OutputInterface $ out ) { $ numTables = 0 ; foreach ( Application :: kernel ( ) -> database ( ) -> getConnections ( ) as $ connectionName => $ connection ) { $ database = $ connection -> getDatabase ( ) -> getDatabaseName ( ) ; $ rows = $ connection -> query ( 'SHOW TABLES' ) ; $ connection -> query ( 'SET FOREIGN_KEY_CHECKS = 0;' ) ; foreach ( $ rows as $ row ) { $ numTables ++ ; $ tableName = array_values ( ( array ) $ row ) [ 0 ] ; $ out -> writeln ( sprintf ( '<fg=yellow>[ᐅ]</> [%s] %s.%s', $ connectionName , $ database , $ tableName ) ) ; $ connection -> query ( 'DROP TABLE IF EXISTS `' . $ tableName . '`;' ) ; } $ connection -> query ( 'SET FOREIGN_KEY_CHECKS = 1;' ) ; } $ out -> writeln ( '<fg=green>[✓]</> dropped tables'); }
Drops all tables in all registered databases.
Drops all tables in all registered databases .