Revert "pgsql schema: remove unnecessary named indexes"

This reverts commit c9bcda5469.
This commit is contained in:
Andrew Dolgov 2015-02-20 22:23:03 +03:00
parent c9bcda5469
commit 1103172909
1 changed files with 25 additions and 0 deletions

View File

@ -98,6 +98,9 @@ create table ttrss_feeds (id serial not null primary key,
favicon_last_checked timestamp default null, favicon_last_checked timestamp default null,
auth_pass_encrypted boolean not null default false); auth_pass_encrypted boolean not null default false);
create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid);
create index ttrss_feeds_cat_id_idx on ttrss_feeds(cat_id);
insert into ttrss_feeds (owner_uid, title, feed_url) values insert into ttrss_feeds (owner_uid, title, feed_url) values
(1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.org/releases.rss'); (1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.org/releases.rss');
@ -117,6 +120,7 @@ create table ttrss_counters_cache (
value integer not null default 0); value integer not null default 0);
create index ttrss_counters_cache_feed_id_idx on ttrss_counters_cache(feed_id); create index ttrss_counters_cache_feed_id_idx on ttrss_counters_cache(feed_id);
create index ttrss_counters_cache_owner_uid_idx on ttrss_counters_cache(owner_uid);
create index ttrss_counters_cache_value_idx on ttrss_counters_cache(value); create index ttrss_counters_cache_value_idx on ttrss_counters_cache(value);
create table ttrss_cat_counters_cache ( create table ttrss_cat_counters_cache (
@ -125,6 +129,8 @@ create table ttrss_cat_counters_cache (
updated timestamp not null, updated timestamp not null,
value integer not null default 0); value integer not null default 0);
create index ttrss_cat_counters_cache_owner_uid_idx on ttrss_cat_counters_cache(owner_uid);
create table ttrss_entries (id serial not null primary key, create table ttrss_entries (id serial not null primary key,
title text not null, title text not null,
guid text not null unique, guid text not null unique,
@ -142,6 +148,7 @@ create table ttrss_entries (id serial not null primary key,
lang varchar(2), lang varchar(2),
author varchar(250) not null default ''); author varchar(250) not null default '');
-- create index ttrss_entries_title_index on ttrss_entries(title);
create index ttrss_entries_date_entered_index on ttrss_entries(date_entered); create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
create index ttrss_entries_updated_idx on ttrss_entries(updated); create index ttrss_entries_updated_idx on ttrss_entries(updated);
@ -163,6 +170,10 @@ create table ttrss_user_entries (
note text, note text,
unread boolean not null default true); unread boolean not null default true);
-- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
create index ttrss_user_entries_ref_id_index on ttrss_user_entries(ref_id);
create index ttrss_user_entries_feed_id on ttrss_user_entries(feed_id);
create index ttrss_user_entries_unread_idx on ttrss_user_entries(unread); create index ttrss_user_entries_unread_idx on ttrss_user_entries(unread);
create table ttrss_entry_comments (id serial not null primary key, create table ttrss_entry_comments (id serial not null primary key,
@ -171,6 +182,9 @@ create table ttrss_entry_comments (id serial not null primary key,
private boolean not null default false, private boolean not null default false,
date_entered timestamp not null); date_entered timestamp not null);
create index ttrss_entry_comments_ref_id_index on ttrss_entry_comments(ref_id);
-- create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
create table ttrss_filter_types (id integer not null primary key, create table ttrss_filter_types (id integer not null primary key,
name varchar(120) unique not null, name varchar(120) unique not null,
description varchar(250) not null unique); description varchar(250) not null unique);
@ -241,6 +255,9 @@ create table ttrss_tags (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,
post_int_id integer references ttrss_user_entries(int_id) ON DELETE CASCADE not null); post_int_id integer references ttrss_user_entries(int_id) ON DELETE CASCADE not null);
create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
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 (127); insert into ttrss_version values (127);
@ -254,6 +271,8 @@ create table ttrss_enclosures (id serial not null primary key,
height integer not null default 0, height integer not null default 0,
post_id integer references ttrss_entries(id) ON DELETE cascade NOT NULL); post_id integer references ttrss_entries(id) ON DELETE cascade NOT NULL);
create index ttrss_enclosures_post_id_idx on ttrss_enclosures(post_id);
create table ttrss_settings_profiles(id serial not null primary key, create table ttrss_settings_profiles(id serial not null primary key,
title varchar(250) not null, title varchar(250) not null,
owner_uid integer not null references ttrss_users(id) on delete cascade); owner_uid integer not null references ttrss_users(id) on delete cascade);
@ -348,10 +367,16 @@ create table ttrss_user_prefs (
profile integer references ttrss_settings_profiles(id) ON DELETE CASCADE, profile integer references ttrss_settings_profiles(id) ON DELETE CASCADE,
value text not null); value text not null);
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_sessions (id varchar(250) not null primary key, create table ttrss_sessions (id varchar(250) not null primary key,
data text, data text,
expire integer not null); expire integer not null);
create index ttrss_sessions_expire_index on ttrss_sessions(expire);
create function SUBSTRING_FOR_DATE(timestamp, int, int) RETURNS text AS 'SELECT SUBSTRING(CAST($1 AS text), $2, $3)' LANGUAGE 'sql'; create function SUBSTRING_FOR_DATE(timestamp, int, int) RETURNS text AS 'SELECT SUBSTRING(CAST($1 AS text), $2, $3)' LANGUAGE 'sql';
create table ttrss_feedbrowser_cache ( create table ttrss_feedbrowser_cache (