DB structures for #31.
This commit is contained in:
parent
5f1af487ad
commit
3d59187937
@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information (
|
||||
inf_value TEXT NOT NULL
|
||||
);
|
||||
-- !
|
||||
INSERT INTO Information VALUES (1, 'schema_version', '14');
|
||||
INSERT INTO Information VALUES (1, 'schema_version', '15');
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS Accounts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
@ -127,4 +127,21 @@ CREATE TABLE IF NOT EXISTS Messages (
|
||||
custom_hash TEXT,
|
||||
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
||||
);
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFilters (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL CHECK (name != ''),
|
||||
script TEXT NOT NULL CHECK (script != '')
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFiltersInFeeds (
|
||||
filter INTEGER NOT NULL,
|
||||
feed_custom_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (filter) REFERENCES MessageFilters (id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
|
||||
);
|
||||
-- !
|
||||
UPDATE Information SET inf_value = '15' WHERE inf_key = 'schema_version';
|
@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information (
|
||||
inf_value TEXT NOT NULL
|
||||
);
|
||||
-- !
|
||||
INSERT INTO Information VALUES (1, 'schema_version', '14');
|
||||
INSERT INTO Information VALUES (1, 'schema_version', '15');
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS Accounts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
@ -121,4 +121,19 @@ CREATE TABLE IF NOT EXISTS Messages (
|
||||
custom_hash TEXT,
|
||||
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFilters (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL CHECK (name != ''),
|
||||
script TEXT NOT NULL CHECK (script != '')
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFiltersInFeeds (
|
||||
filter INTEGER NOT NULL,
|
||||
feed_custom_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (filter) REFERENCES MessageFilters (id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
|
||||
);
|
16
resources/sql/db_update_mysql_14_15.sql
Executable file
16
resources/sql/db_update_mysql_14_15.sql
Executable file
@ -0,0 +1,16 @@
|
||||
CREATE TABLE IF NOT EXISTS MessageFilters (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL CHECK (name != ''),
|
||||
script TEXT NOT NULL CHECK (script != '')
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFiltersInFeeds (
|
||||
filter INTEGER NOT NULL,
|
||||
feed_custom_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (filter) REFERENCES MessageFilters (id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
|
||||
);
|
||||
-- !
|
||||
UPDATE Information SET inf_value = '15' WHERE inf_key = 'schema_version';
|
16
resources/sql/db_update_sqlite_14_15.sql
Executable file
16
resources/sql/db_update_sqlite_14_15.sql
Executable file
@ -0,0 +1,16 @@
|
||||
CREATE TABLE IF NOT EXISTS MessageFilters (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL CHECK (name != ''),
|
||||
script TEXT NOT NULL CHECK (script != '')
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE IF NOT EXISTS MessageFiltersInFeeds (
|
||||
filter INTEGER NOT NULL,
|
||||
feed_custom_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
|
||||
FOREIGN KEY (filter) REFERENCES MessageFilters (id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
|
||||
);
|
||||
-- !
|
||||
UPDATE Information SET inf_value = '15' WHERE inf_key = 'schema_version';
|
Loading…
x
Reference in New Issue
Block a user