2015-04-28 20:01:59 +02:00
|
|
|
DROP DATABASE IF EXISTS ##;
|
2014-02-07 21:39:59 +01:00
|
|
|
-- !
|
2015-04-28 20:01:59 +02:00
|
|
|
CREATE DATABASE IF NOT EXISTS ## CHARACTER SET utf8 COLLATE utf8_general_ci;
|
2014-02-07 21:39:59 +01:00
|
|
|
-- !
|
2015-04-28 20:01:59 +02:00
|
|
|
USE ##;
|
2014-02-07 21:39:59 +01:00
|
|
|
-- !
|
|
|
|
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
|
|
|
|
);
|
|
|
|
-- !
|
2016-02-26 12:19:37 +01:00
|
|
|
INSERT INTO Information VALUES (1, 'schema_version', '6');
|
2014-02-07 21:39:59 +01:00
|
|
|
-- !
|
2015-12-02 13:32:19 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS Accounts (
|
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
type TEXT NOT NULL
|
|
|
|
);
|
|
|
|
-- !
|
2015-12-03 09:19:59 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS TtRssAccounts (
|
2015-12-07 09:42:46 +01:00
|
|
|
id INTEGER,
|
2015-12-03 09:19:59 +01:00
|
|
|
username TEXT NOT NULL,
|
|
|
|
password TEXT,
|
2016-03-09 20:07:53 +01:00
|
|
|
auth_protected INTEGER(1) NOT NULL DEFAULT 0 CHECK (auth_protected >= 0 AND auth_protected <= 1),
|
2015-12-15 07:43:41 +01:00
|
|
|
auth_username TEXT,
|
|
|
|
auth_password TEXT,
|
2015-12-03 09:19:59 +01:00
|
|
|
url TEXT NOT NULL,
|
2016-03-09 20:07:53 +01:00
|
|
|
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
2015-12-03 09:19:59 +01:00
|
|
|
|
|
|
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
|
|
);
|
2016-02-18 08:20:49 +01:00
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
|
|
|
|
id INTEGER,
|
|
|
|
username TEXT NOT NULL,
|
|
|
|
password TEXT,
|
|
|
|
url TEXT NOT NULL,
|
2016-03-09 20:07:53 +01:00
|
|
|
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
|
2016-02-18 08:20:49 +01:00
|
|
|
|
|
|
|
FOREIGN KEY (id) REFERENCES Accounts (id)
|
|
|
|
);
|
2014-02-07 21:39:59 +01:00
|
|
|
DROP TABLE IF EXISTS Categories;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS Categories (
|
|
|
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
parent_id INTEGER NOT NULL,
|
2015-12-03 10:53:48 +01:00
|
|
|
title VARCHAR(100) NOT NULL CHECK (title != ''),
|
2014-02-07 21:39:59 +01:00
|
|
|
description TEXT,
|
2015-12-08 09:11:55 +01:00
|
|
|
date_created BIGINT,
|
2015-12-03 10:53:48 +01:00
|
|
|
icon BLOB,
|
|
|
|
account_id INTEGER NOT NULL,
|
2015-12-03 13:42:50 +01:00
|
|
|
custom_id TEXT,
|
2015-12-03 10:53:48 +01:00
|
|
|
|
|
|
|
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
2014-02-07 21:39:59 +01:00
|
|
|
);
|
|
|
|
-- !
|
|
|
|
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,
|
2015-12-08 09:11:55 +01:00
|
|
|
date_created BIGINT,
|
2014-02-07 21:39:59 +01:00
|
|
|
icon BLOB,
|
|
|
|
category INTEGER NOT NULL CHECK (category >= -1),
|
2015-12-08 09:11:55 +01:00
|
|
|
encoding TEXT,
|
|
|
|
url VARCHAR(100),
|
2014-02-07 21:39:59 +01:00
|
|
|
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),
|
2016-03-09 20:07:53 +01:00
|
|
|
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 5),
|
2015-12-08 09:11:55 +01:00
|
|
|
type INTEGER,
|
2015-12-03 10:53:48 +01:00
|
|
|
account_id INTEGER NOT NULL,
|
2015-12-03 13:42:50 +01:00
|
|
|
custom_id TEXT,
|
2015-12-03 10:53:48 +01:00
|
|
|
|
|
|
|
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
2014-02-07 21:39:59 +01:00
|
|
|
);
|
|
|
|
-- !
|
|
|
|
DROP TABLE IF EXISTS Messages;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS Messages (
|
|
|
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
2016-03-09 20:07:53 +01:00
|
|
|
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),
|
2015-12-11 13:56:05 +01:00
|
|
|
feed TEXT NOT NULL,
|
2014-02-07 21:39:59 +01:00
|
|
|
title TEXT NOT NULL CHECK (title != ''),
|
2015-12-14 07:06:15 +01:00
|
|
|
url TEXT,
|
2015-12-11 13:56:05 +01:00
|
|
|
author TEXT,
|
2014-02-07 21:39:59 +01:00
|
|
|
date_created BIGINT NOT NULL CHECK (date_created != 0),
|
|
|
|
contents TEXT,
|
2016-03-09 20:07:53 +01:00
|
|
|
is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1),
|
2015-04-06 18:55:40 +02:00
|
|
|
enclosures TEXT,
|
2015-12-03 10:29:25 +01:00
|
|
|
account_id INTEGER NOT NULL,
|
2015-12-03 13:42:50 +01:00
|
|
|
custom_id TEXT,
|
2016-02-26 09:15:57 +01:00
|
|
|
custom_hash TEXT,
|
2014-02-07 21:39:59 +01:00
|
|
|
|
2015-12-03 10:29:25 +01:00
|
|
|
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
2015-05-27 19:15:37 +02:00
|
|
|
);
|