mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Fix migration on Linux
This commit is contained in:
parent
ea12ec9607
commit
c3d9883ddb
@ -1,8 +1,8 @@
|
||||
BEGIN TRANSACTION;
|
||||
-- New Columns
|
||||
ALTER TABLE Accounts ADD BanReason TEXT DEFAULT '' NOT NULL;
|
||||
ALTER TABLE RaceResults ADD RingCount INTEGER NOT NULL;
|
||||
ALTER TABLE RaceResults ADD Time INTEGER NOT NULL;
|
||||
ALTER TABLE RaceResults ADD RingCount INTEGER DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE RaceResults ADD Time INTEGER DEFAULT 0 NOT NULL;
|
||||
-- Fix timestamps in Meta
|
||||
INSERT INTO Meta (Key, Value) VALUES ('Created', 0);
|
||||
INSERT INTO Meta (Key, Value) VALUES ('LastMigration', strftime('%s', 'now'));
|
||||
@ -11,7 +11,7 @@ UPDATE Meta SET Value = (SELECT Created FROM Meta WHERE Key = 'ProtocolVersion')
|
||||
CREATE TABLE Temp(Key TEXT NOT NULL UNIQUE, Value INTEGER NOT NULL);
|
||||
INSERT INTO Temp SELECT Key, Value FROM Meta;
|
||||
DROP TABLE Meta;
|
||||
ALTER TABLE Temp Rename TO Meta;
|
||||
ALTER TABLE Temp RENAME TO Meta;
|
||||
-- Update DB Version
|
||||
UPDATE Meta SET Value = 2 WHERE Key = 'DatabaseVersion';
|
||||
UPDATE Meta SET Value = strftime('%s', 'now') WHERE Key = 'LastMigration';
|
||||
|
@ -162,7 +162,7 @@ void Database::checkMetaTable() {
|
||||
int rc = sqlite3_exec(db, sql.c_str(), NULL, NULL, NULL);
|
||||
|
||||
if (rc != SQLITE_OK) {
|
||||
std::cout << "[FATAL] Failed to migrate database" << std::endl;
|
||||
std::cout << "[FATAL] Failed to migrate database: " << sqlite3_errmsg(db) << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -179,8 +179,7 @@ void Database::createMetaTable() {
|
||||
const char* sql = R"(
|
||||
CREATE TABLE Meta(
|
||||
Key TEXT NOT NULL UNIQUE,
|
||||
Value INTEGER NOT NULL,
|
||||
Created INTEGER DEFAULT (strftime('%s', 'now'))
|
||||
Value INTEGER NOT NULL
|
||||
);
|
||||
)";
|
||||
sqlite3_stmt* stmt;
|
||||
|
Loading…
Reference in New Issue
Block a user