add ttrss_feed_categories.parent_cat, bump schema

This commit is contained in:
Andrew Dolgov 2012-08-13 14:36:52 +04:00
parent 9765e8b9f1
commit 9432bfa076
4 changed files with 26 additions and 2 deletions

View file

@ -57,6 +57,9 @@ create table ttrss_feed_categories(id integer not null primary key auto_incremen
title varchar(200) not null, title varchar(200) not null,
collapsed bool not null default false, collapsed bool not null default false,
order_id integer not null default 0, 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), index(owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8; 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; 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, create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null, content_url text not null,

View file

@ -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, owner_uid integer not null references ttrss_users(id) on delete cascade,
collapsed boolean not null default false, collapsed boolean not null default false,
order_id integer not null default 0, order_id integer not null default 0,
parent_cat integer references ttrss_feed_categories(id) on delete set null,
title varchar(200) not null); title varchar(200) not null);
create table ttrss_feeds (id serial not null primary key, 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); 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, create table ttrss_enclosures (id serial not null primary key,
content_url text not null, content_url text not null,

View file

@ -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;

View file

@ -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;