mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-01 02:48:05 +01:00
Prepare DB for storing of msg limit - OwnCloud.
This commit is contained in:
parent
7f16f5153c
commit
72337653c6
@ -38,6 +38,7 @@ CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
||||
password TEXT,
|
||||
url TEXT NOT NULL,
|
||||
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
||||
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||
|
||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||
);
|
||||
|
@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
||||
password TEXT,
|
||||
url TEXT NOT NULL,
|
||||
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
|
||||
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||
|
||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||
);
|
||||
|
4
resources/sql/db_update_mysql_8_9.sql
Executable file
4
resources/sql/db_update_mysql_8_9.sql
Executable file
@ -0,0 +1,4 @@
|
||||
ALTER TABLE OwnCloudAccounts
|
||||
ADD COLUMN msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1);
|
||||
-- !
|
||||
UPDATE Information SET inf_value = '9' WHERE inf_key = 'schema_version';
|
21
resources/sql/db_update_sqlite_8_9.sql
Executable file
21
resources/sql/db_update_sqlite_8_9.sql
Executable file
@ -0,0 +1,21 @@
|
||||
CREATE TABLE backup_oa AS SELECT * FROM OwnCloudAccounts;
|
||||
-- !
|
||||
DROP TABLE OwnCloudAccounts;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
||||
id INTEGER,
|
||||
username TEXT NOT NULL,
|
||||
password TEXT,
|
||||
url TEXT NOT NULL,
|
||||
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
|
||||
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
|
||||
|
||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
||||
);
|
||||
-- !
|
||||
INSERT INTO OwnCloudAccounts (id, username, password, url, force_update)
|
||||
SELECT id, username, password, url, force_update FROM backup_oa;
|
||||
-- !
|
||||
DROP TABLE backup_oa;
|
||||
-- !
|
||||
UPDATE Information SET inf_value = '9' WHERE inf_key = 'schema_version';
|
@ -121,7 +121,7 @@
|
||||
#define APP_DB_SQLITE_FILE "database.db"
|
||||
|
||||
// Keep this in sync with schema versions declared in SQL initialization code.
|
||||
#define APP_DB_SCHEMA_VERSION "8"
|
||||
#define APP_DB_SCHEMA_VERSION "9"
|
||||
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
|
||||
#define APP_DB_COMMENT_SPLIT "-- !\n"
|
||||
#define APP_DB_NAME_PLACEHOLDER "##"
|
||||
|
@ -342,7 +342,7 @@ QSqlDatabase DatabaseFactory::sqliteInitializeFileBasedDatabase(const QString& c
|
||||
const QString installed_db_schema = query_db.value(0).toString();
|
||||
query_db.finish();
|
||||
|
||||
if (installed_db_schema < APP_DB_SCHEMA_VERSION) {
|
||||
if (installed_db_schema.toInt() < QString(APP_DB_SCHEMA_VERSION).toInt()) {
|
||||
if (sqliteUpdateDatabaseSchema(database, installed_db_schema)) {
|
||||
qDebug("Database schema was updated from '%s' to '%s' successully or it is already up to date.",
|
||||
qPrintable(installed_db_schema),
|
||||
|
Loading…
Reference in New Issue
Block a user