Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/sql/onlinetasks/sepa/sepastorageplugin.cpp
Context not available. | |||||
57 | 57 | | |||
---|---|---|---|---|---|
58 | // Create database in it's most recent version if version is 0 | 58 | // Create database in it's most recent version if version is 0 | ||
59 | // (version 0 means the database was not installed) | 59 | // (version 0 means the database was not installed) | ||
60 | if (currentVersion == 0) { | 60 | if (currentVersion <= 1) { | ||
61 | // If the database is recreated the table may be still there. So drop it if needed. No error handling needed | 61 | // If the database is recreated the table may be still there. So drop it if needed. No error handling needed | ||
62 | // as this step is not necessary - only the creation is important. | 62 | // as this step is not necessary - only the creation is important. | ||
63 | if (!query.exec("DROP TABLE IF EXISTS kmmSepaOrders;")) | 63 | if (!query.exec("DROP TABLE IF EXISTS kmmSepaOrders;")) | ||
Context not available. | |||||
65 | 65 | | |||
66 | if (!query.exec( | 66 | if (!query.exec( | ||
67 | "CREATE TABLE kmmSepaOrders (" | 67 | "CREATE TABLE kmmSepaOrders (" | ||
68 | " id varchar(32) NOT NULL PRIMARY KEY REFERENCES kmmOnlineJobs( id )," | 68 | " id varchar(32) NOT NULL PRIMARY KEY REFERENCES kmmOnlineJobs( id ) ON UPDATE CASCADE ON DELETE CASCADE," | ||
69 | " originAccount varchar(32) REFERENCES kmmAccounts( id ) ON UPDATE CASCADE ON DELETE SET NULL," | 69 | " originAccount varchar(32) REFERENCES kmmAccounts( id ) ON UPDATE CASCADE ON DELETE SET NULL," | ||
70 | " value text DEFAULT '0'," | 70 | " value text DEFAULT '0'," | ||
71 | " purpose text," | 71 | " purpose text," | ||
Context not available. | |||||
81 | return false; | 81 | return false; | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | query.prepare("DELETE FROM kmmPluginInfo WHERE iid = ?;"); | ||||
85 | query.bindValue(0, iid); | ||||
86 | query.exec(); | ||||
87 | | ||||
84 | query.prepare("INSERT INTO kmmPluginInfo (iid, versionMajor, versionMinor, uninstallQuery) VALUES(?, ?, ?, ?)"); | 88 | query.prepare("INSERT INTO kmmPluginInfo (iid, versionMajor, versionMinor, uninstallQuery) VALUES(?, ?, ?, ?)"); | ||
85 | query.bindValue(0, iid); | 89 | query.bindValue(0, iid); | ||
86 | query.bindValue(1, 1); | 90 | query.bindValue(1, 2); | ||
87 | query.bindValue(2, 0); | 91 | query.bindValue(2, 0); | ||
88 | query.bindValue(3, "DROP TABLE kmmSepaOrders;"); | 92 | query.bindValue(3, "DROP TABLE kmmSepaOrders;"); | ||
89 | if (query.exec()) | 93 | if (query.exec()) | ||
Context not available. | |||||
94 | 98 | | |||
95 | // Check if version is valid with this plugin | 99 | // Check if version is valid with this plugin | ||
96 | switch (currentVersion) { | 100 | switch (currentVersion) { | ||
97 | case 1: return true; | 101 | case 2: return true; | ||
98 | } | 102 | } | ||
99 | 103 | | |||
100 | return false; | 104 | return false; | ||
Context not available. |