From 0c0cba75f8c9bcb6b172a11929265de115d25caa Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Wed, 31 Jan 2018 04:06:35 +0300 Subject: [PATCH] paths of migration changed --- scripts/migration.php | 62 ++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/scripts/migration.php b/scripts/migration.php index 876ca9d..f2273ef 100644 --- a/scripts/migration.php +++ b/scripts/migration.php @@ -1,55 +1,51 @@ prepare('SELECT `sql_schema` FROM `application` LIMIT 1'); $req->execute(); $data = $req->fetch(); $sql_schema = -1; if ($data['sql_schema']) { - $sql_schema = $data['sql_schema']; + $sql_schema = $data['sql_schema']; } - } - // Table does not exist - catch (Exception $e) { +} // Table does not exist +catch (Exception $e) { $sql_schema = -1; - } +} - // For each migrations - foreach ($migrations as $migration_value) { +// For each migrations +foreach ($migrations as $migration_value) { // Do the migration, we are behind the last schema if ($sql_schema < $migration_value) { - // Create the tables or die - $sql_file = dirname(__FILE__) . "/sql/schema-$migration_value.sql"; - try { - $sql = file_get_contents($sql_file); - $bdd->exec($sql); - } - catch (PDOException $e) { - printError($e->getMessage()); - exit(1); - } - - // Update schema to the new value - updateSchema($bdd, $migration_value); - - echo "Moved to schema $migration_value\n"; - } - } + // Create the tables or die + $sql_file = dirname(__FILE__) . "/sql/schema-$migration_value.sql"; + try { + $sql = file_get_contents($sql_file); + $bdd->exec($sql); + } catch (PDOException $e) { + printError($e->getMessage()); + exit(1); + } + + // Update schema to the new value + updateSchema($bdd, $migration_value); -?> + echo "Moved to schema $migration_value\n"; + } +}