diff --git a/src/mibew/configs/database_schema.yml b/src/mibew/configs/database_schema.yml index 3f3d5ef9..d8b7c71e 100644 --- a/src/mibew/configs/database_schema.yml +++ b/src/mibew/configs/database_schema.yml @@ -314,6 +314,8 @@ plugin: installed: "tinyint NOT NULL DEFAULT 0" # Indicates if the plugin is enabled or not. enabled: "tinyint NOT NULL DEFAULT 0" + # Indicates if the plugin is initialized or not. + initialized: "tinyint NOT NULL DEFAULT 0" unique_keys: name: [name] diff --git a/src/mibew/libs/classes/Mibew/Maintenance/Updater.php b/src/mibew/libs/classes/Mibew/Maintenance/Updater.php index 7970d87c..7408c7ec 100644 --- a/src/mibew/libs/classes/Mibew/Maintenance/Updater.php +++ b/src/mibew/libs/classes/Mibew/Maintenance/Updater.php @@ -412,4 +412,30 @@ class Updater return true; } + + /** + * Performs all database updates needed for 2.2.0. + * + * @return boolean True if the updates have been applied successfully and + * false otherwise. + */ + protected function update20200() + { + $db = $this->getDatabase(); + + if (!$db) { + return false; + } + + try { + // Alter locale table. + $db->query('ALTER TABLE {plugin} ADD COLUMN initialized tinyint NOT NULL DEFAULT 0 AFTER enabled'); + } catch (\Exception $e) { + $this->errors[] = getlocal('Cannot update tables: {0}', $e->getMessage()); + + return false; + } + + return true; + } }