Update database schema

Add into the plugins table a column to store last known initialization status
This commit is contained in:
Fedor A. Fetisov 2016-12-28 03:55:15 +03:00
parent 3f97ad09df
commit 57afba72e8
2 changed files with 28 additions and 0 deletions

View File

@ -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]

View File

@ -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;
}
}