mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-29 00:30:12 +01:00
Huge fixes for MySQL backend.
This commit is contained in:
parent
5821d87a85
commit
1618562295
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS GmailAccounts (
|
||||
id INTEGER,
|
||||
username TEXT NOT NULL,
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE Feeds
|
||||
MODIFY url VARCHAR(1000);
|
||||
-- !
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE TtRssAccounts
|
||||
ADD COLUMN update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1);
|
||||
-- !
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE OwnCloudAccounts
|
||||
ADD COLUMN update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1);
|
||||
-- !
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFilters (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL CHECK (name != ''),
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS Labels (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL CHECK (name != ''),
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
-- !
|
||||
ALTER TABLE Labels MODIFY id INTEGER AUTO_INCREMENT;
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE Messages
|
||||
ADD COLUMN enclosures TEXT;
|
||||
-- !
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE Accounts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
type TEXT NOT NULL
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
||||
id INTEGER,
|
||||
username TEXT NOT NULL,
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE Messages
|
||||
ADD COLUMN custom_hash TEXT;
|
||||
-- !
|
||||
|
@ -3,18 +3,18 @@ ALTER DATABASE ##
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_unicode_ci;
|
||||
-- !
|
||||
USE ##
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE messages
|
||||
ALTER TABLE Messages
|
||||
CONVERT TO CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
-- !
|
||||
ALTER TABLE messages
|
||||
ALTER TABLE Messages
|
||||
CHANGE title title TEXT
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
-- !
|
||||
ALTER TABLE messages
|
||||
ALTER TABLE Messages
|
||||
CHANGE contents contents TEXT
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS Labels (
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
account_id INTEGER NOT NULL,
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
ALTER TABLE OwnCloudAccounts
|
||||
ADD COLUMN msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1);
|
||||
-- !
|
||||
|
@ -1,3 +1,5 @@
|
||||
USE ##;
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS InoreaderAccounts (
|
||||
id INTEGER,
|
||||
username TEXT NOT NULL,
|
||||
|
@ -498,6 +498,8 @@ bool DatabaseFactory::mysqlUpdateDatabaseSchema(const QSqlDatabase& database,
|
||||
QSqlQuery query = database.exec(statement.replace(APP_DB_NAME_PLACEHOLDER, db_name));
|
||||
|
||||
if (query.lastError().isValid()) {
|
||||
auto xx = query.lastError().text();
|
||||
|
||||
qFatal("Query for updating database schema failed: '%s'.", qPrintable(query.lastError().text()));
|
||||
}
|
||||
}
|
||||
@ -772,7 +774,7 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString& connection_
|
||||
query_db.next();
|
||||
const QString installed_db_schema = query_db.value(0).toString();
|
||||
|
||||
if (installed_db_schema < APP_DB_SCHEMA_VERSION) {
|
||||
if (installed_db_schema.toInt() < QString(APP_DB_SCHEMA_VERSION).toInt()) {
|
||||
if (mysqlUpdateDatabaseSchema(database, installed_db_schema, database_name)) {
|
||||
qDebugNN << LOGSEC_DB
|
||||
<< "Database schema was updated from '"
|
||||
|
Loading…
x
Reference in New Issue
Block a user