2014-01-12 11:53:58 +01:00
|
|
|
DROP TABLE IF EXISTS Information;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS Information (
|
2014-02-07 17:00:26 +01:00
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
inf_key TEXT NOT NULL,
|
|
|
|
inf_value TEXT NOT NULL
|
2014-01-12 11:53:58 +01:00
|
|
|
);
|
|
|
|
-- !
|
2014-02-07 17:00:26 +01:00
|
|
|
INSERT INTO Information VALUES (1, 'schema_version', '0.0.1');
|
2014-02-01 10:05:28 +01:00
|
|
|
-- !
|
2014-01-12 11:53:58 +01:00
|
|
|
DROP TABLE IF EXISTS Categories;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS Categories (
|
2014-02-01 10:05:28 +01:00
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
parent_id INTEGER NOT NULL,
|
|
|
|
title TEXT NOT NULL UNIQUE CHECK (title != ''),
|
|
|
|
description TEXT,
|
|
|
|
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
2014-03-29 08:36:34 +01:00
|
|
|
icon BLOB
|
2014-01-12 11:53:58 +01:00
|
|
|
);
|
|
|
|
-- !
|
|
|
|
DROP TABLE IF EXISTS Feeds;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS Feeds (
|
2014-02-01 10:05:28 +01:00
|
|
|
id INTEGER PRIMARY KEY,
|
|
|
|
title TEXT NOT NULL CHECK (title != ''),
|
|
|
|
description TEXT,
|
|
|
|
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
|
|
|
icon BLOB,
|
|
|
|
category INTEGER NOT NULL CHECK (category >= -1),
|
|
|
|
encoding TEXT NOT NULL CHECK (encoding != ''),
|
|
|
|
url TEXT NOT NULL UNIQUE CHECK (url != ''),
|
|
|
|
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
|
|
|
username TEXT,
|
|
|
|
password TEXT,
|
2014-02-03 16:57:02 +01:00
|
|
|
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
|
|
|
update_interval INTEGER NOT NULL CHECK (update_interval >= 5) DEFAULT 15,
|
2014-02-01 10:05:28 +01:00
|
|
|
type INTEGER NOT NULL CHECK (type >= 0)
|
2014-01-12 11:53:58 +01:00
|
|
|
);
|
|
|
|
-- !
|
|
|
|
DROP TABLE IF EXISTS FeedsData;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS FeedsData (
|
2014-02-01 10:05:28 +01:00
|
|
|
feed_id INTEGER NOT NULL,
|
2014-02-07 20:15:05 +01:00
|
|
|
feed_key TEXT NOT NULL,
|
|
|
|
feed_value TEXT,
|
2014-01-12 11:53:58 +01:00
|
|
|
|
2014-02-07 20:15:05 +01:00
|
|
|
PRIMARY KEY (feed_id, feed_key),
|
2014-01-31 13:09:26 +01:00
|
|
|
FOREIGN KEY (feed_id) REFERENCES Feeds (id)
|
2014-01-12 11:53:58 +01:00
|
|
|
);
|
|
|
|
-- !
|
|
|
|
DROP TABLE IF EXISTS Messages;
|
|
|
|
-- !
|
|
|
|
CREATE TABLE IF NOT EXISTS Messages (
|
2014-02-01 10:05:28 +01:00
|
|
|
id INTEGER PRIMARY KEY,
|
2014-02-07 17:00:26 +01:00
|
|
|
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),
|
2014-02-01 10:05:28 +01:00
|
|
|
feed INTEGER NOT NULL,
|
|
|
|
title TEXT NOT NULL CHECK (title != ''),
|
2014-02-21 21:45:28 +01:00
|
|
|
url TEXT NOT NULL,
|
|
|
|
author TEXT NOT NULL,
|
2014-02-01 10:05:28 +01:00
|
|
|
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
|
|
|
contents TEXT,
|
2014-01-12 11:53:58 +01:00
|
|
|
|
|
|
|
FOREIGN KEY (feed) REFERENCES Feeds (id)
|
|
|
|
);
|