Merge pull request #427 from andersk/duplicate-indexes

Drop duplicate database indexes
This commit is contained in:
Andrew Dolgov 2014-12-18 11:55:36 +03:00
commit 06f328a31b
5 changed files with 31 additions and 20 deletions

View File

@ -1,6 +1,6 @@
<?php
define('EXPECTED_CONFIG_VERSION', 26);
define('SCHEMA_VERSION', 126);
define('SCHEMA_VERSION', 127);
define('LABEL_BASE_INDEX', -1024);
define('PLUGIN_FEED_BASE_INDEX', -128);

View File

@ -133,9 +133,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
view_settings varchar(250) not null default '',
pubsub_state integer not null default 0,
favicon_last_checked datetime default null,
index(owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
index(cat_id),
foreign key (cat_id) references ttrss_feed_categories(id) ON DELETE SET NULL,
index(parent_feed),
foreign key (parent_feed) references ttrss_feeds(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
@ -167,7 +165,6 @@ create table ttrss_entries (id integer not null primary key auto_increment,
author varchar(250) not null default '') ENGINE=InnoDB DEFAULT CHARSET=UTF8;
create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
create index ttrss_entries_guid_index on ttrss_entries(guid);
create index ttrss_entries_updated_idx on ttrss_entries(updated);
create table ttrss_user_entries (
@ -187,13 +184,10 @@ create table ttrss_user_entries (
last_marked datetime,
last_published 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 (orig_feed_id),
foreign key (orig_feed_id) references ttrss_archived_feeds(id) ON DELETE SET NULL,
index (owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
@ -301,7 +295,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 (126);
insert into ttrss_version values (127);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
@ -311,7 +305,6 @@ create table ttrss_enclosures (id integer primary key auto_increment,
duration text not null,
width integer not null default 0,
height integer not null default 0,
index (post_id),
foreign key (post_id) references ttrss_entries(id) ON DELETE cascade) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
create index ttrss_enclosures_post_id_idx on ttrss_enclosures(post_id);
@ -347,8 +340,6 @@ create table ttrss_prefs (pref_name varchar(250) not null primary key,
index(section_id),
foreign key (section_id) references ttrss_prefs_sections(id)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
create index ttrss_prefs_pref_name_idx on ttrss_prefs(pref_name);
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('PURGE_OLD_DAYS', 3, '60', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 2);
@ -418,18 +409,15 @@ create table ttrss_user_prefs (
profile integer,
index (profile),
foreign key (profile) references ttrss_settings_profiles(id) ON DELETE CASCADE,
index (owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
index (pref_name),
foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
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 table ttrss_sessions (id varchar(250) unique not null primary key,
create table ttrss_sessions (id varchar(250) not null primary key,
data text,
expire integer not null,
index (id),
index (expire)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_feedbrowser_cache (

View File

@ -148,7 +148,6 @@ create table ttrss_entries (id serial not null primary key,
lang varchar(2),
author 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 index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
create index ttrss_entries_updated_idx on ttrss_entries(updated);
@ -261,7 +260,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 (126);
insert into ttrss_version values (127);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
@ -300,8 +299,6 @@ create table ttrss_prefs (pref_name varchar(250) not null primary key,
access_level integer not null default 0,
def_value text not null);
create index ttrss_prefs_pref_name_idx on ttrss_prefs(pref_name);
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('PURGE_OLD_DAYS', 3, '60', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 2);
@ -374,7 +371,7 @@ 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) unique not null primary key,
create table ttrss_sessions (id varchar(250) not null primary key,
data text,
expire integer not null);

View File

@ -0,0 +1,18 @@
BEGIN;
ALTER TABLE ttrss_enclosures DROP INDEX post_id;
ALTER TABLE ttrss_entries DROP INDEX ttrss_entries_guid_index;
ALTER TABLE ttrss_feeds DROP INDEX owner_uid;
ALTER TABLE ttrss_feeds DROP INDEX cat_id;
ALTER TABLE ttrss_prefs DROP INDEX ttrss_prefs_pref_name_idx;
ALTER TABLE ttrss_sessions DROP INDEX id_2;
ALTER TABLE ttrss_sessions DROP INDEX id;
ALTER TABLE ttrss_user_entries DROP INDEX ref_id;
ALTER TABLE ttrss_user_entries DROP INDEX owner_uid;
ALTER TABLE ttrss_user_entries DROP INDEX feed_id;
ALTER TABLE ttrss_user_prefs DROP INDEX pref_name;
ALTER TABLE ttrss_user_prefs DROP INDEX owner_uid;
UPDATE ttrss_version SET schema_version = 127;
COMMIT;

View File

@ -0,0 +1,8 @@
BEGIN;
DROP INDEX ttrss_entries_guid_index;
DROP INDEX ttrss_prefs_pref_name_idx;
UPDATE ttrss_version SET schema_version = 127;
COMMIT;