]> git.wh0rd.org - tt-rss.git/commitdiff
new schema adapted for mysql, PG schema fixes
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 10:03:47 +0000 (11:03 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 10:03:47 +0000 (11:03 +0100)
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql

index 507c26e75bdb36a4f81ea83e861c027bb99f7d6e..6851d6170de68b95c44e558792222ee61e9d9525 100644 (file)
@@ -1,5 +1,8 @@
 drop table if exists ttrss_tags;
+
+drop table if exists ttrss_user_entries;
 drop table if exists ttrss_entries;
+
 drop table if exists ttrss_feeds;
 drop table if exists ttrss_labels;
 drop table if exists ttrss_filters;
@@ -38,20 +41,26 @@ insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net',
    'http://syndication.technocrat.net/rss');
 
 create table ttrss_entries (id integer not null primary key auto_increment, 
-       owner_uid integer not null,
-       feed_id integer not null,
-       updated datetime not null, 
        title text not null, 
-       guid varchar(255) not null, 
+       guid varchar(255) not null unique
        link text not null, 
+       updated datetime not null, 
        content text not null,
        content_hash varchar(250) not null,
-       last_read datetime,
-       marked bool not null default 0,
-       date_entered datetime not null,
        no_orig_date bool not null default 0,
-       comments varchar(250) not null default '',
+       date_entered datetime not null,
+       comments varchar(250) not null default '') TYPE=InnoDB;
+
+create table ttrss_user_entries (
+       int_id integer not null primary key auto_increment,
+       ref_id integer not null,
+       feed_id int not null, 
+       owner_uid integer not null,
+       marked bool not null default 0,
+       last_read datetime,
        unread bool not null default 1,
+       index (ref_id),
+       foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
        index (feed_id),
        foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
        index (owner_uid),
@@ -64,7 +73,6 @@ create table ttrss_filter_types (id integer primary key,
        name varchar(120) unique not null, 
        description varchar(250) not null unique) TYPE=InnoDB;
 
-
 insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
 insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
 insert into ttrss_filter_types (id,name,description) values (3, 'both', 
@@ -98,9 +106,9 @@ insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
 create table ttrss_tags (id integer primary key auto_increment, 
        owner_uid integer not null, 
        tag_name varchar(250) not null,
-       post_id integer not null,
-       index (post_id),
-       foreign key (post_id) references ttrss_entries(id) ON DELETE CASCADE,
+       post_int_id integer not null,
+       index (post_int_id),
+       foreign key (post_int_id) references ttrss_user_entries(int_id) ON DELETE CASCADE,
        index (owner_uid),
        foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;
 
index e1d07c425068d887e08dad8287b69ef74b50f22e..0abb81304413bfe836ce04086d55f28707547974 100644 (file)
@@ -49,8 +49,10 @@ create table ttrss_entries (id serial not null primary key,
        content_hash varchar(250) not null,
        no_orig_date boolean not null default false,
        date_entered timestamp not null default NOW(),
-       comments varchar(250) not null default '',
-       index (guid), index(title));
+       comments varchar(250) not null default '');
+
+create index ttrss_entries_guid_index on ttrss_entries(guid);
+create index ttrss_entries_title_index on ttrss_entries(title);
 
 create table ttrss_user_entries (
        int_id serial not null primary key,