From 1112922029d9eb8fe727d5adb1b5b0a1808946aa Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 25 Feb 2021 10:11:09 +0300 Subject: bump schema for upcoming prefs overhaul --- schema/ttrss_schema_mysql.sql | 11 ++++++++++- schema/ttrss_schema_pgsql.sql | 13 ++++++++++++- schema/versions/mysql/141.sql | 9 +++++++++ schema/versions/pgsql/141.sql | 11 +++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 schema/versions/mysql/141.sql create mode 100644 schema/versions/pgsql/141.sql (limited to 'schema') diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 95d01e721..7916c0728 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -18,6 +18,7 @@ drop table if exists ttrss_filters; drop table if exists ttrss_filter_types; drop table if exists ttrss_filter_actions; drop table if exists ttrss_user_prefs; +drop table if exists ttrss_user_prefs2; drop table if exists ttrss_prefs; drop table if exists ttrss_prefs_types; drop table if exists ttrss_prefs_sections; @@ -297,7 +298,7 @@ create table ttrss_tags (id integer primary key auto_increment, create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8; -insert into ttrss_version values (140); +insert into ttrss_version values (141); create table ttrss_enclosures (id integer primary key auto_increment, content_url text not null, @@ -411,6 +412,14 @@ create table ttrss_user_prefs ( foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8; +create table ttrss_user_prefs2 ( + owner_uid integer not null, + pref_name varchar(250), + profile integer null, + value longtext not null, + foreign key (profile) references ttrss_settings_profiles(id) ON DELETE CASCADE, + foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8; + create table ttrss_sessions (id varchar(250) not null primary key, data text, expire integer not null, diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index f73933ba1..266a37f37 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -15,6 +15,7 @@ drop table if exists ttrss_filters; drop table if exists ttrss_filter_types; drop table if exists ttrss_filter_actions; drop table if exists ttrss_user_prefs; +drop table if exists ttrss_user_prefs2; drop table if exists ttrss_prefs; drop table if exists ttrss_prefs_types; drop table if exists ttrss_prefs_sections; @@ -279,7 +280,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id); create table ttrss_version (schema_version int not null); -insert into ttrss_version values (140); +insert into ttrss_version values (141); create table ttrss_enclosures (id serial not null primary key, content_url text not null, @@ -391,6 +392,16 @@ create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid); create index ttrss_user_prefs_pref_name_idx on ttrss_user_prefs(pref_name); -- create index ttrss_user_prefs_value_index on ttrss_user_prefs(value); +create table ttrss_user_prefs2 ( + owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, + pref_name varchar(250) not null, + profile integer references ttrss_settings_profiles(id) ON DELETE CASCADE, + value text not null); + +create index ttrss_user_prefs2_owner_uid_index on ttrss_user_prefs2(owner_uid); +create index ttrss_user_prefs2_pref_name_idx on ttrss_user_prefs2(pref_name); +create unique index ttrss_user_prefs2_composite_idx on ttrss_user_prefs2(pref_name, owner_uid, coalesce(profile, -1)); + create table ttrss_sessions (id varchar(250) not null primary key, data text, expire integer not null); diff --git a/schema/versions/mysql/141.sql b/schema/versions/mysql/141.sql new file mode 100644 index 000000000..03caf23d0 --- /dev/null +++ b/schema/versions/mysql/141.sql @@ -0,0 +1,9 @@ +create table ttrss_user_prefs2 ( + owner_uid integer not null, + pref_name varchar(250), + profile integer null, + value longtext not null, + foreign key (profile) references ttrss_settings_profiles(id) ON DELETE CASCADE, + foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8; + +update ttrss_version set schema_version = 141; diff --git a/schema/versions/pgsql/141.sql b/schema/versions/pgsql/141.sql new file mode 100644 index 000000000..679ca9498 --- /dev/null +++ b/schema/versions/pgsql/141.sql @@ -0,0 +1,11 @@ +create table ttrss_user_prefs2 ( + owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, + pref_name varchar(250) not null, + profile integer references ttrss_settings_profiles(id) ON DELETE CASCADE, + value text not null); + +create index ttrss_user_prefs2_owner_uid_index on ttrss_user_prefs2(owner_uid); +create index ttrss_user_prefs2_pref_name_idx on ttrss_user_prefs2(pref_name); +create unique index ttrss_user_prefs2_composite_idx on ttrss_user_prefs2(pref_name, owner_uid, coalesce(profile, -1)); + +update ttrss_version set schema_version = 141; -- cgit v1.2.3