Rename sql folder.
This commit is contained in:
parent
cb15ba92c9
commit
a8345e6afc
@ -1,102 +0,0 @@
|
|||||||
DROP DATABASE IF EXISTS ##;
|
|
||||||
-- !
|
|
||||||
CREATE DATABASE IF NOT EXISTS ## CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
||||||
-- !
|
|
||||||
USE ##;
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS Information;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Information (
|
|
||||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
inf_key TEXT NOT NULL,
|
|
||||||
inf_value TEXT NOT NULL
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Information VALUES (1, 'schema_version', '6');
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Accounts (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
type TEXT NOT NULL
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS TtRssAccounts (
|
|
||||||
id INTEGER,
|
|
||||||
username TEXT NOT NULL,
|
|
||||||
password TEXT,
|
|
||||||
auth_protected INTEGER(1) NOT NULL DEFAULT 0 CHECK (auth_protected >= 0 AND auth_protected <= 1),
|
|
||||||
auth_username TEXT,
|
|
||||||
auth_password TEXT,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
|
||||||
id INTEGER,
|
|
||||||
username TEXT NOT NULL,
|
|
||||||
password TEXT,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
DROP TABLE IF EXISTS Categories;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Categories (
|
|
||||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
parent_id INTEGER NOT NULL,
|
|
||||||
title VARCHAR(100) NOT NULL CHECK (title != ''),
|
|
||||||
description TEXT,
|
|
||||||
date_created BIGINT,
|
|
||||||
icon BLOB,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS Feeds;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Feeds (
|
|
||||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
description TEXT,
|
|
||||||
date_created BIGINT,
|
|
||||||
icon BLOB,
|
|
||||||
category INTEGER NOT NULL CHECK (category >= -1),
|
|
||||||
encoding TEXT,
|
|
||||||
url VARCHAR(100),
|
|
||||||
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
|
||||||
username TEXT,
|
|
||||||
password TEXT,
|
|
||||||
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
|
||||||
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 5),
|
|
||||||
type INTEGER,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS Messages;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Messages (
|
|
||||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
is_read INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_read >= 0 AND is_read <= 1),
|
|
||||||
is_deleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_deleted >= 0 AND is_deleted <= 1),
|
|
||||||
is_important INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_important >= 0 AND is_important <= 1),
|
|
||||||
feed TEXT NOT NULL,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
url TEXT,
|
|
||||||
author TEXT,
|
|
||||||
date_created BIGINT NOT NULL CHECK (date_created != 0),
|
|
||||||
contents TEXT,
|
|
||||||
is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1),
|
|
||||||
enclosures TEXT,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
custom_hash TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
@ -1,97 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS Information;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Information (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
inf_key TEXT NOT NULL,
|
|
||||||
inf_value TEXT NOT NULL
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Information VALUES (1, 'schema_version', '6');
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Accounts (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
type TEXT NOT NULL
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS TtRssAccounts (
|
|
||||||
id INTEGER,
|
|
||||||
username TEXT NOT NULL,
|
|
||||||
password TEXT,
|
|
||||||
auth_protected INTEGER(1) NOT NULL CHECK (auth_protected >= 0 AND auth_protected <= 1) DEFAULT 0,
|
|
||||||
auth_username TEXT,
|
|
||||||
auth_password TEXT,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
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,
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS Categories;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Categories (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
parent_id INTEGER NOT NULL,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
description TEXT,
|
|
||||||
date_created INTEGER,
|
|
||||||
icon BLOB,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS Feeds;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Feeds (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
description TEXT,
|
|
||||||
date_created INTEGER,
|
|
||||||
icon BLOB,
|
|
||||||
category INTEGER NOT NULL CHECK (category >= -1),
|
|
||||||
encoding TEXT,
|
|
||||||
url TEXT,
|
|
||||||
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
|
||||||
username TEXT,
|
|
||||||
password TEXT,
|
|
||||||
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
|
||||||
update_interval INTEGER NOT NULL CHECK (update_interval >= 5) DEFAULT 15,
|
|
||||||
type INTEGER,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS Messages;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE IF NOT EXISTS Messages (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT 0,
|
|
||||||
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT 0,
|
|
||||||
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT 0,
|
|
||||||
feed TEXT NOT NULL,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
url TEXT,
|
|
||||||
author TEXT,
|
|
||||||
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
|
||||||
contents TEXT,
|
|
||||||
is_pdeleted INTEGER(1) NOT NULL CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1) DEFAULT 0,
|
|
||||||
enclosures TEXT,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
custom_hash TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1);
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '2' WHERE inf_key = 'schema_version';
|
|
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN enclosures TEXT;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '3' WHERE inf_key = 'schema_version';
|
|
@ -1,68 +0,0 @@
|
|||||||
CREATE TABLE Accounts (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
type TEXT NOT NULL
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Accounts (type) VALUES ('std-rss');
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS FeedsData;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE TtRssAccounts (
|
|
||||||
id INTEGER,
|
|
||||||
username TEXT NOT NULL,
|
|
||||||
password TEXT,
|
|
||||||
auth_protected INTEGER(1) NOT NULL DEFAULT 0 CHECK (auth_protected >= 0 AND auth_protected <= 1),
|
|
||||||
auth_username TEXT,
|
|
||||||
auth_password TEXT,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN account_id INTEGER NOT NULL DEFAULT 1;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN custom_id TEXT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Messages
|
|
||||||
DROP FOREIGN KEY feed;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Messages
|
|
||||||
MODIFY feed TEXT NOT NULL;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Messages
|
|
||||||
MODIFY author TEXT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Messages
|
|
||||||
MODIFY url TEXT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Feeds
|
|
||||||
ADD COLUMN account_id INTEGER NOT NULL DEFAULT 1;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Feeds
|
|
||||||
ADD COLUMN custom_id TEXT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Feeds
|
|
||||||
MODIFY date_created BIGINT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Feeds
|
|
||||||
MODIFY encoding TEXT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Feeds
|
|
||||||
MODIFY url VARCHAR(100);
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Feeds
|
|
||||||
MODIFY type INTEGER;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Categories
|
|
||||||
ADD COLUMN account_id INTEGER NOT NULL DEFAULT 1;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Categories
|
|
||||||
ADD COLUMN custom_id TEXT;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE Categories
|
|
||||||
MODIFY date_created BIGINT;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';
|
|
@ -1,23 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
|
||||||
id INTEGER,
|
|
||||||
username TEXT NOT NULL,
|
|
||||||
password TEXT,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
UPDATE Categories
|
|
||||||
SET custom_id = (SELECT id FROM Categories t WHERE t.id = Categories.id)
|
|
||||||
WHERE Categories.custom_id IS NULL OR Categories.custom_id = '';
|
|
||||||
-- !
|
|
||||||
UPDATE Feeds
|
|
||||||
SET custom_id = (SELECT id FROM Feeds t WHERE t.id = Feeds.id)
|
|
||||||
WHERE Feeds.custom_id IS NULL OR Feeds.custom_id = '';
|
|
||||||
-- !
|
|
||||||
UPDATE Messages
|
|
||||||
SET custom_id = (SELECT id FROM Messages t WHERE t.id = Messages.id)
|
|
||||||
WHERE Messages.custom_id IS NULL OR Messages.custom_id = '';
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '5' WHERE inf_key = 'schema_version';
|
|
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN custom_hash TEXT;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '6' WHERE inf_key = 'schema_version';
|
|
@ -1,22 +0,0 @@
|
|||||||
-- !
|
|
||||||
ALTER DATABASE ##
|
|
||||||
CHARACTER SET = utf8mb4
|
|
||||||
COLLATE = utf8mb4_unicode_ci;
|
|
||||||
-- !
|
|
||||||
USE ##
|
|
||||||
-- !
|
|
||||||
ALTER TABLE messages
|
|
||||||
CONVERT TO CHARACTER SET utf8mb4
|
|
||||||
COLLATE utf8mb4_unicode_ci;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE messages
|
|
||||||
CHANGE title title TEXT
|
|
||||||
CHARACTER SET utf8mb4
|
|
||||||
COLLATE utf8mb4_unicode_ci;
|
|
||||||
-- !
|
|
||||||
ALTER TABLE messages
|
|
||||||
CHANGE contents contents TEXT
|
|
||||||
CHARACTER SET utf8mb4
|
|
||||||
COLLATE utf8mb4_unicode_ci;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '7' WHERE inf_key = 'schema_version';
|
|
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1);
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '2' WHERE inf_key = 'schema_version';
|
|
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE Messages
|
|
||||||
ADD COLUMN enclosures TEXT;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '3' WHERE inf_key = 'schema_version';
|
|
@ -1,103 +0,0 @@
|
|||||||
CREATE TABLE Accounts (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
type TEXT NOT NULL
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Accounts (type) VALUES ('std-rss');
|
|
||||||
-- !
|
|
||||||
DROP TABLE IF EXISTS FeedsData;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE TtRssAccounts (
|
|
||||||
id INTEGER,
|
|
||||||
username TEXT NOT NULL,
|
|
||||||
password TEXT,
|
|
||||||
auth_protected INTEGER(1) NOT NULL CHECK (auth_protected >= 0 AND auth_protected <= 1) DEFAULT 0,
|
|
||||||
auth_username TEXT,
|
|
||||||
auth_password TEXT,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
CREATE TABLE backup_Messages AS SELECT * FROM Messages;
|
|
||||||
-- !
|
|
||||||
DROP TABLE Messages;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE Messages (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT 0,
|
|
||||||
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT 0,
|
|
||||||
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT 0,
|
|
||||||
feed TEXT NOT NULL,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
url TEXT,
|
|
||||||
author TEXT,
|
|
||||||
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
|
||||||
contents TEXT,
|
|
||||||
is_pdeleted INTEGER(1) NOT NULL CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1) DEFAULT 0,
|
|
||||||
enclosures TEXT,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Messages (id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id)
|
|
||||||
SELECT id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, 1 FROM backup_Messages;
|
|
||||||
-- !
|
|
||||||
DROP TABLE backup_Messages;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE backup_Feeds AS SELECT * FROM Feeds;
|
|
||||||
-- !
|
|
||||||
DROP TABLE Feeds;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE Feeds (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
description TEXT,
|
|
||||||
date_created INTEGER,
|
|
||||||
icon BLOB,
|
|
||||||
category INTEGER NOT NULL CHECK (category >= -1),
|
|
||||||
encoding TEXT,
|
|
||||||
url TEXT,
|
|
||||||
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
|
||||||
username TEXT,
|
|
||||||
password TEXT,
|
|
||||||
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
|
||||||
update_interval INTEGER NOT NULL CHECK (update_interval >= 5) DEFAULT 15,
|
|
||||||
type INTEGER,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Feeds (id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_type, type, account_id)
|
|
||||||
SELECT id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_type, type, 1 FROM backup_Feeds;
|
|
||||||
-- !
|
|
||||||
DROP TABLE backup_Feeds;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE backup_Categories AS SELECT * FROM Categories;
|
|
||||||
-- !
|
|
||||||
DROP TABLE Categories;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE Categories (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
parent_id INTEGER NOT NULL,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
description TEXT,
|
|
||||||
date_created INTEGER,
|
|
||||||
icon BLOB,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Categories (id, parent_id, title, description, date_created, icon, account_id)
|
|
||||||
SELECT id, parent_id, title, description, date_created, icon, 1 FROM backup_Categories;
|
|
||||||
-- !
|
|
||||||
DROP TABLE backup_Categories;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';
|
|
@ -1,23 +0,0 @@
|
|||||||
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,
|
|
||||||
|
|
||||||
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
UPDATE Categories
|
|
||||||
SET custom_id = (SELECT id FROM Categories t WHERE t.id = Categories.id)
|
|
||||||
WHERE Categories.custom_id IS NULL OR Categories.custom_id = '';
|
|
||||||
-- !
|
|
||||||
UPDATE Feeds
|
|
||||||
SET custom_id = (SELECT id FROM Feeds t WHERE t.id = Feeds.id)
|
|
||||||
WHERE Feeds.custom_id IS NULL OR Feeds.custom_id = '';
|
|
||||||
-- !
|
|
||||||
UPDATE Messages
|
|
||||||
SET custom_id = (SELECT id FROM Messages t WHERE t.id = Messages.id)
|
|
||||||
WHERE Messages.custom_id IS NULL OR Messages.custom_id = '';
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '5' WHERE inf_key = 'schema_version';
|
|
@ -1,30 +0,0 @@
|
|||||||
CREATE TABLE backup_Messages AS SELECT * FROM Messages;
|
|
||||||
-- !
|
|
||||||
DROP TABLE Messages;
|
|
||||||
-- !
|
|
||||||
CREATE TABLE Messages (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT 0,
|
|
||||||
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT 0,
|
|
||||||
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT 0,
|
|
||||||
feed TEXT NOT NULL,
|
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
|
||||||
url TEXT,
|
|
||||||
author TEXT,
|
|
||||||
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
|
||||||
contents TEXT,
|
|
||||||
is_pdeleted INTEGER(1) NOT NULL CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1) DEFAULT 0,
|
|
||||||
enclosures TEXT,
|
|
||||||
account_id INTEGER NOT NULL,
|
|
||||||
custom_id TEXT,
|
|
||||||
custom_hash TEXT,
|
|
||||||
|
|
||||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
|
||||||
);
|
|
||||||
-- !
|
|
||||||
INSERT INTO Messages (id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id)
|
|
||||||
SELECT id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id FROM backup_Messages;
|
|
||||||
-- !
|
|
||||||
DROP TABLE backup_Messages;
|
|
||||||
-- !
|
|
||||||
UPDATE Information SET inf_value = '6' WHERE inf_key = 'schema_version';
|
|
@ -1 +0,0 @@
|
|||||||
UPDATE Information SET inf_value = '7' WHERE inf_key = 'schema_version';
|
|
@ -1,3 +1,9 @@
|
|||||||
|
3.4.1
|
||||||
|
—————
|
||||||
|
|
||||||
|
Changed:
|
||||||
|
▪ Folder which holds SQL scripts got renamed to "sql".
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
—————
|
—————
|
||||||
|
|
||||||
|
15
rssguard.pro
15
rssguard.pro
@ -613,8 +613,8 @@ mac {
|
|||||||
win32 {
|
win32 {
|
||||||
target.path = $$PREFIX
|
target.path = $$PREFIX
|
||||||
|
|
||||||
misc_sql.files = resources/misc/*.sql
|
misc_sql.files = resources/sql/*.sql
|
||||||
misc_sql.path = $$PREFIX/misc
|
misc_sql.path = $$quote($$PREFIX/sql/)
|
||||||
|
|
||||||
qt_dlls_root.files = resources/binaries/windows/qt5-msvc2015/*.*
|
qt_dlls_root.files = resources/binaries/windows/qt5-msvc2015/*.*
|
||||||
qt_dlls_root.path = $$quote($$PREFIX/)
|
qt_dlls_root.path = $$quote($$PREFIX/)
|
||||||
@ -643,9 +643,6 @@ win32 {
|
|||||||
skins.files = resources/skins
|
skins.files = resources/skins
|
||||||
skins.path = $$quote($$PREFIX/)
|
skins.path = $$quote($$PREFIX/)
|
||||||
|
|
||||||
sql.files = resources/misc
|
|
||||||
sql.path = $$quote($$PREFIX/)
|
|
||||||
|
|
||||||
feeds.files = resources/initial_feeds
|
feeds.files = resources/initial_feeds
|
||||||
feeds.path = $$quote($$PREFIX/)
|
feeds.path = $$quote($$PREFIX/)
|
||||||
|
|
||||||
@ -667,7 +664,7 @@ win32 {
|
|||||||
INSTALLS += target misc_sql qt_dlls_root qt_dlls_bearer qt_dlls_iconengines \
|
INSTALLS += target misc_sql qt_dlls_root qt_dlls_bearer qt_dlls_iconengines \
|
||||||
qt_dlls_imageformats qt_dlls_platforms qt_dlls_sqldrivers \
|
qt_dlls_imageformats qt_dlls_platforms qt_dlls_sqldrivers \
|
||||||
misc_icons faenza skins \
|
misc_icons faenza skins \
|
||||||
sql feeds texts ico app_icon app_plain_icon translations
|
feeds texts ico app_icon app_plain_icon translations
|
||||||
|
|
||||||
equals(USE_WEBENGINE, true) {
|
equals(USE_WEBENGINE, true) {
|
||||||
# Copy extra resource files for QtWebEngine.
|
# Copy extra resource files for QtWebEngine.
|
||||||
@ -692,8 +689,8 @@ unix:!mac {
|
|||||||
target.path = $$PREFIX/bin
|
target.path = $$PREFIX/bin
|
||||||
|
|
||||||
# Install SQL initializers.
|
# Install SQL initializers.
|
||||||
misc_sql.files = resources/misc/*.sql
|
misc_sql.files = resources/sql/*.sql
|
||||||
misc_sql.path = $$quote($$PREFIX/share/$$TARGET/misc/)
|
misc_sql.path = $$quote($$PREFIX/share/$$TARGET/sql/)
|
||||||
|
|
||||||
# Misc icons.
|
# Misc icons.
|
||||||
misc_icons.files = resources/graphics/misc
|
misc_icons.files = resources/graphics/misc
|
||||||
@ -739,7 +736,7 @@ mac {
|
|||||||
IDENTIFIER = org.$${TARGET}.RSSGuard
|
IDENTIFIER = org.$${TARGET}.RSSGuard
|
||||||
|
|
||||||
# Install SQL initializers.
|
# Install SQL initializers.
|
||||||
misc_sql.files = resources/misc
|
misc_sql.files = resources/sql
|
||||||
misc_sql.path = Contents/Resources
|
misc_sql.path = Contents/Resources
|
||||||
|
|
||||||
# Misc icons.
|
# Misc icons.
|
||||||
|
@ -216,7 +216,7 @@
|
|||||||
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/skins")
|
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/skins")
|
||||||
#define APP_INFO_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/information")
|
#define APP_INFO_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/information")
|
||||||
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/icons")
|
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/icons")
|
||||||
#define APP_MISC_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/misc")
|
#define APP_SQL_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/sql")
|
||||||
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/../share/pixmaps/rssguard.png")
|
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/../share/pixmaps/rssguard.png")
|
||||||
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/icons/rssguard_plain.png")
|
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/icons/rssguard_plain.png")
|
||||||
#define APP_INITIAL_FEEDS_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/initial_feeds")
|
#define APP_INITIAL_FEEDS_PATH QApplication::applicationDirPath() + QString("/../share/rssguard/initial_feeds")
|
||||||
@ -227,7 +227,7 @@
|
|||||||
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/../Resources/skins")
|
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/../Resources/skins")
|
||||||
#define APP_INFO_PATH QApplication::applicationDirPath() + QString("/../Resources/information")
|
#define APP_INFO_PATH QApplication::applicationDirPath() + QString("/../Resources/information")
|
||||||
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/../Resources/icons")
|
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/../Resources/icons")
|
||||||
#define APP_MISC_PATH QApplication::applicationDirPath() + QString("/../Resources/misc")
|
#define APP_SQL_PATH QApplication::applicationDirPath() + QString("/../Resources/sql")
|
||||||
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/../Resources/icons/rssguard.png")
|
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/../Resources/icons/rssguard.png")
|
||||||
#define APP_INFO_PATH QApplication::applicationDirPath() + QString("/../Resources/information")
|
#define APP_INFO_PATH QApplication::applicationDirPath() + QString("/../Resources/information")
|
||||||
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/../Resources/icons/rssguard_plain.png")
|
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/../Resources/icons/rssguard_plain.png")
|
||||||
@ -239,7 +239,7 @@
|
|||||||
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/skins")
|
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/skins")
|
||||||
#define APP_INFO_PATH QApplication::applicationDirPath()
|
#define APP_INFO_PATH QApplication::applicationDirPath()
|
||||||
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/icons")
|
#define APP_THEME_PATH QApplication::applicationDirPath() + QString("/icons")
|
||||||
#define APP_MISC_PATH QApplication::applicationDirPath() + QString("/misc")
|
#define APP_SQL_PATH QApplication::applicationDirPath() + QString("/sql")
|
||||||
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/rssguard.png")
|
#define APP_ICON_PATH QApplication::applicationDirPath() + QString("/rssguard.png")
|
||||||
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/rssguard_plain.png")
|
#define APP_ICON_PLAIN_PATH QApplication::applicationDirPath() + QString("/rssguard_plain.png")
|
||||||
#define APP_INITIAL_FEEDS_PATH QApplication::applicationDirPath() + QString("/initial_feeds")
|
#define APP_INITIAL_FEEDS_PATH QApplication::applicationDirPath() + QString("/initial_feeds")
|
||||||
|
@ -216,13 +216,13 @@ QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
|||||||
if (query_db.lastError().isValid()) {
|
if (query_db.lastError().isValid()) {
|
||||||
qWarning("Error occurred. In-memory SQLite database is not initialized. Initializing now.");
|
qWarning("Error occurred. In-memory SQLite database is not initialized. Initializing now.");
|
||||||
|
|
||||||
QFile file_init(APP_MISC_PATH + QDir::separator() + APP_DB_SQLITE_INIT);
|
QFile file_init(APP_SQL_PATH + QDir::separator() + APP_DB_SQLITE_INIT);
|
||||||
|
|
||||||
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
// Database initialization file not opened. HUGE problem.
|
// Database initialization file not opened. HUGE problem.
|
||||||
qFatal("In-memory SQLite database initialization file '%s' from directory '%s' was not found. In-memory database is uninitialized.",
|
qFatal("In-memory SQLite database initialization file '%s' from directory '%s' was not found. In-memory database is uninitialized.",
|
||||||
APP_DB_SQLITE_INIT,
|
APP_DB_SQLITE_INIT,
|
||||||
qPrintable(APP_MISC_PATH));
|
qPrintable(APP_SQL_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
||||||
@ -329,13 +329,13 @@ QSqlDatabase DatabaseFactory::sqliteInitializeFileBasedDatabase(const QString &c
|
|||||||
if (!query_db.exec(QSL("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'"))) {
|
if (!query_db.exec(QSL("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'"))) {
|
||||||
qWarning("Error occurred. File-based SQLite database is not initialized. Initializing now.");
|
qWarning("Error occurred. File-based SQLite database is not initialized. Initializing now.");
|
||||||
|
|
||||||
QFile file_init(APP_MISC_PATH + QDir::separator() + APP_DB_SQLITE_INIT);
|
QFile file_init(APP_SQL_PATH + QDir::separator() + APP_DB_SQLITE_INIT);
|
||||||
|
|
||||||
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
// Database initialization file not opened. HUGE problem.
|
// Database initialization file not opened. HUGE problem.
|
||||||
qFatal("SQLite database initialization file '%s' from directory '%s' was not found. File-based database is uninitialized.",
|
qFatal("SQLite database initialization file '%s' from directory '%s' was not found. File-based database is uninitialized.",
|
||||||
APP_DB_SQLITE_INIT,
|
APP_DB_SQLITE_INIT,
|
||||||
qPrintable(APP_MISC_PATH));
|
qPrintable(APP_SQL_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
||||||
@ -402,7 +402,7 @@ bool DatabaseFactory::sqliteUpdateDatabaseSchema(QSqlDatabase database, const QS
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (working_version != current_version) {
|
while (working_version != current_version) {
|
||||||
const QString update_file_name = QString(APP_MISC_PATH) + QDir::separator() +
|
const QString update_file_name = QString(APP_SQL_PATH) + QDir::separator() +
|
||||||
QString(APP_DB_UPDATE_FILE_PATTERN).arg(QSL("sqlite"),
|
QString(APP_DB_UPDATE_FILE_PATTERN).arg(QSL("sqlite"),
|
||||||
QString::number(working_version),
|
QString::number(working_version),
|
||||||
QString::number(working_version + 1));
|
QString::number(working_version + 1));
|
||||||
@ -440,7 +440,7 @@ bool DatabaseFactory::mysqlUpdateDatabaseSchema(QSqlDatabase database, const QSt
|
|||||||
const int current_version = QString(APP_DB_SCHEMA_VERSION).remove('.').toInt();
|
const int current_version = QString(APP_DB_SCHEMA_VERSION).remove('.').toInt();
|
||||||
|
|
||||||
while (working_version != current_version) {
|
while (working_version != current_version) {
|
||||||
const QString update_file_name = QString(APP_MISC_PATH) + QDir::separator() +
|
const QString update_file_name = QString(APP_SQL_PATH) + QDir::separator() +
|
||||||
QString(APP_DB_UPDATE_FILE_PATTERN).arg(QSL("mysql"),
|
QString(APP_DB_UPDATE_FILE_PATTERN).arg(QSL("mysql"),
|
||||||
QString::number(working_version),
|
QString::number(working_version),
|
||||||
QString::number(working_version + 1));
|
QString::number(working_version + 1));
|
||||||
@ -661,13 +661,13 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
|
|||||||
// If no "rssguard" database exists or schema version is wrong, then initialize it.
|
// If no "rssguard" database exists or schema version is wrong, then initialize it.
|
||||||
qWarning("Error occurred. MySQL database is not initialized. Initializing now.");
|
qWarning("Error occurred. MySQL database is not initialized. Initializing now.");
|
||||||
|
|
||||||
QFile file_init(APP_MISC_PATH + QDir::separator() + APP_DB_MYSQL_INIT);
|
QFile file_init(APP_SQL_PATH + QDir::separator() + APP_DB_MYSQL_INIT);
|
||||||
|
|
||||||
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
// Database initialization file not opened. HUGE problem.
|
// Database initialization file not opened. HUGE problem.
|
||||||
qFatal("MySQL database initialization file '%s' from directory '%s' was not found. File-based database is uninitialized.",
|
qFatal("MySQL database initialization file '%s' from directory '%s' was not found. File-based database is uninitialized.",
|
||||||
APP_DB_MYSQL_INIT,
|
APP_DB_MYSQL_INIT,
|
||||||
qPrintable(APP_MISC_PATH));
|
qPrintable(APP_SQL_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user