From 89e31b9d4e721da222d3fbb5e66b0c6a18961ac9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 20 Feb 2015 12:49:58 +0300 Subject: [PATCH] migration: remove mandatory index drops from 127 because of potential fatal errors; remove unnecessary named indexes from mysql schema for fields with foreign key constraints (mysql should create indexes automatically on table creation for those fields) --- schema/ttrss_schema_mysql.sql | 16 ---------------- schema/versions/mysql/127.sql | 13 ------------- 2 files changed, 29 deletions(-) diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 6cb15373..89a2730c 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -86,7 +86,6 @@ create table ttrss_counters_cache ( ) ENGINE=InnoDB DEFAULT CHARSET=UTF8; 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 table ttrss_cat_counters_cache ( @@ -97,8 +96,6 @@ create table ttrss_cat_counters_cache ( foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=UTF8; -create index ttrss_cat_counters_cache_owner_uid_idx on ttrss_cat_counters_cache(owner_uid); - create table ttrss_feeds (id integer not null auto_increment primary key, owner_uid integer not null, title varchar(200) not null, @@ -135,12 +132,8 @@ create table ttrss_feeds (id integer not null auto_increment primary key, favicon_last_checked datetime default null, foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, 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; -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 (1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.org/releases.rss'); @@ -186,13 +179,9 @@ create table ttrss_user_entries ( unread bool not null default 1, foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE, 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, 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); -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 table ttrss_entry_comments (id integer not null primary key, @@ -307,8 +296,6 @@ create table ttrss_enclosures (id integer primary key auto_increment, height integer not null default 0, 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); - create table ttrss_settings_profiles(id integer primary key auto_increment, title varchar(250) not null, owner_uid integer not null, @@ -412,9 +399,6 @@ create table ttrss_user_prefs ( foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, 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) not null primary key, data text, expire integer not null, diff --git a/schema/versions/mysql/127.sql b/schema/versions/mysql/127.sql index 5dcc23b2..2c521d86 100644 --- a/schema/versions/mysql/127.sql +++ b/schema/versions/mysql/127.sql @@ -1,18 +1,5 @@ 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;