Fixed upgrade
This commit is contained in:
parent
a105edc4ab
commit
77fa9a926d
|
@ -94,7 +94,7 @@ CREATE TABLE IF NOT EXISTS options (
|
||||||
|
|
||||||
DELETE FROM options where name='schema_version';
|
DELETE FROM options where name='schema_version';
|
||||||
|
|
||||||
INSERT INTO options(name,value) VALUES ('schema_version', 3);
|
INSERT INTO options(name,value) VALUES ('schema_version', 4);
|
||||||
";
|
";
|
||||||
|
|
||||||
$sql["pgsql"]="
|
$sql["pgsql"]="
|
||||||
|
@ -180,7 +180,7 @@ CREATE TABLE IF NOT EXISTS options (
|
||||||
|
|
||||||
DELETE FROM options where name='schema_version';
|
DELETE FROM options where name='schema_version';
|
||||||
|
|
||||||
INSERT INTO options(name,value) VALUES ('schema_version', 3);
|
INSERT INTO options(name,value) VALUES ('schema_version', 4);
|
||||||
";
|
";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -129,6 +129,27 @@ if(isset($input->action) && $input->action == "requestUpgrade") {
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
|
if($currentVersion < 4) {
|
||||||
|
$sql["mysql"] = "
|
||||||
|
RENAME TABLE user TO users;
|
||||||
|
ALTER TABLE permissions CHANGE user userid INT(11);
|
||||||
|
|
||||||
|
UPDATE options SET value=4 WHERE name='schema_version';
|
||||||
|
";
|
||||||
|
$sql["pgsql"] = "UPDATE options SET value=4 WHERE name='schema_version';";
|
||||||
|
|
||||||
|
$queries = explode(";", $sql[$dbType]);
|
||||||
|
|
||||||
|
$db->beginTransaction();
|
||||||
|
|
||||||
|
foreach ($queries as $query) {
|
||||||
|
if (preg_replace('/\s+/', '', $query) != '') {
|
||||||
|
$db->exec($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
|
||||||
$retval['status'] = "success";
|
$retval['status'] = "success";
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getExpectedVersion() {
|
function getExpectedVersion() {
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkVersion($db) {
|
function checkVersion($db) {
|
||||||
|
|
Loading…
Reference in a new issue