exit(0); } } } echo 'The following migrators are run: ' . PHP_EOL; $new_migrators = array(); foreach ($migrators as $migrator) { echo '- ' . $migrator . PHP_EOL; $new_migrators[] = $migrator; } $migrators = $new_migrators; // Setup databases echo "Connecting to databases...\n"; $eve_connection = \Eve\Module::getDatabaseConfig()['eve_connection']; $evedbo_conn = new PDO($eve_connection['dsn'], $eve_connection['user'], $eve_connection['password']); $connection = \Eve\Module::getDatabaseConfig()['connection']; $neweve_conn = pg_connect('host=' . $connection['host'] . ' ' . 'user='******'user'] . ' ' . 'password='******'password'] . ' ' . 'dbname=neweve'); echo "Successfully connected to databases.\n"; // Do actual migrations echo "Beginning transaction...\n"; pg_query($neweve_conn, "BEGIN TRANSACTION"); pg_query($neweve_conn, "SET CONSTRAINTS ALL DEFERRED"); $failure = false; $result_now = pg_query($neweve_conn, "SELECT NOW()"); $now = pg_fetch_row($result_now)[0]; echo "Transaction starting time: " . $now . PHP_EOL; if (isset($options['create-tables']) && !$options['create-tables']) { $source_sql_filename = '/sql/neweve.sql'; echo 'Creating all tables...' . PHP_EOL; $source_sql = file_get_contents(getcwd() . $source_sql_filename); $failure = !pg_query($neweve_conn, $source_sql);