aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2021-08-31 10:15:50 +0200
committerElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2021-09-01 15:12:48 +0200
commitcc13fcc341bcade1a33f7d86dc7c5478762711e7 (patch)
treed2ecb31c217279260f352981acd9e0242c36b613
parenteddc17064d610dbcf372739dd5c5fd2caa788048 (diff)
always validate schema version
-rw-r--r--app/controllers/web_migrate.php2
-rwxr-xr-xcli/migrate.php2
-rw-r--r--lib/migrations/DBSchemaVersion.php3
3 files changed, 2 insertions, 5 deletions
diff --git a/app/controllers/web_migrate.php b/app/controllers/web_migrate.php
index af22959..2637578 100644
--- a/app/controllers/web_migrate.php
+++ b/app/controllers/web_migrate.php
@@ -17,8 +17,6 @@ class WebMigrateController extends StudipController
parent::before_filter($action, $args);
- DBSchemaVersion::validateSchemaVersion();
-
$this->target = Request::int('target');
$this->branch = Request::get('branch', '0');
$this->version = new DBSchemaVersion('studip', $this->branch);
diff --git a/cli/migrate.php b/cli/migrate.php
index 0fe6bc3..618132a 100755
--- a/cli/migrate.php
+++ b/cli/migrate.php
@@ -53,8 +53,6 @@ if (isset($_SERVER['argv'])) {
}
}
- DBSchemaVersion::validateSchemaVersion();
-
$version = new DBSchemaVersion($domain, $branch);
$migrator = new Migrator($path, $version, $verbose);
diff --git a/lib/migrations/DBSchemaVersion.php b/lib/migrations/DBSchemaVersion.php
index 8217ec0..61894be 100644
--- a/lib/migrations/DBSchemaVersion.php
+++ b/lib/migrations/DBSchemaVersion.php
@@ -45,6 +45,7 @@ class DBSchemaVersion implements SchemaVersion
$this->domain = $domain;
$this->branch = $branch;
$this->versions = [0];
+ $this->validateSchemaVersion();
$this->initSchemaInfo();
}
@@ -158,7 +159,7 @@ class DBSchemaVersion implements SchemaVersion
/**
* Validate correct structure of schema_version table.
*/
- public static function validateSchemaVersion()
+ private function validateSchemaVersion()
{
$db = DBManager::get();
$result = $db->query("SHOW TABLES LIKE 'schema_versions'");