From 9432bfa076738b47fce25c4a5a3293201bf21099 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 13 Aug 2012 14:36:52 +0400 Subject: [PATCH] add ttrss_feed_categories.parent_cat, bump schema --- schema/ttrss_schema_mysql.sql | 5 ++++- schema/ttrss_schema_pgsql.sql | 3 ++- schema/versions/mysql/93.sql | 10 ++++++++++ schema/versions/pgsql/93.sql | 10 ++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 schema/versions/mysql/93.sql create mode 100644 schema/versions/pgsql/93.sql diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 5e6ca609..3f63d44e 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -57,6 +57,9 @@ create table ttrss_feed_categories(id integer not null primary key auto_incremen title varchar(200) not null, collapsed bool not null default false, order_id integer not null default 0, + parent_cat integer, + index(parent_cat), + foreign key (parent_cat) references ttrss_feed_categories(id) ON DELETE SET NULL, index(owner_uid), foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8; @@ -267,7 +270,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 (92); +insert into ttrss_version values (93); create table ttrss_enclosures (id integer primary key auto_increment, content_url text not null, diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index 3e0d800c..d5d3f88f 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -52,6 +52,7 @@ create table ttrss_feed_categories(id serial not null primary key, owner_uid integer not null references ttrss_users(id) on delete cascade, collapsed boolean not null default false, order_id integer not null default 0, + parent_cat integer references ttrss_feed_categories(id) on delete set null, title varchar(200) not null); create table ttrss_feeds (id serial not null primary key, @@ -231,7 +232,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 (92); +insert into ttrss_version values (93); create table ttrss_enclosures (id serial not null primary key, content_url text not null, diff --git a/schema/versions/mysql/93.sql b/schema/versions/mysql/93.sql new file mode 100644 index 00000000..56b96e3b --- /dev/null +++ b/schema/versions/mysql/93.sql @@ -0,0 +1,10 @@ +begin; + +alter table ttrss_feed_categories add column parent_cat integer; +update ttrss_feed_categories set parent_cat = NULL; + +alter table ttrss_feed_categories add FOREIGN KEY (parent_cat) REFERENCES ttrss_feed_categories(id) ON DELETE SET NULL; + +update ttrss_version set schema_version = 93; + +commit; diff --git a/schema/versions/pgsql/93.sql b/schema/versions/pgsql/93.sql new file mode 100644 index 00000000..0374c0b0 --- /dev/null +++ b/schema/versions/pgsql/93.sql @@ -0,0 +1,10 @@ +begin; + +alter table ttrss_feed_categories add column parent_cat integer; +update ttrss_feed_categories set parent_cat = NULL; + +alter table ttrss_feed_categories add constraint "$2" FOREIGN KEY (parent_cat) REFERENCES ttrss_feed_categories(id) ON DELETE SET NULL; + +update ttrss_version set schema_version = 93; + +commit; -- 2.39.5