From 3ca638bc926ae3bb1d23a5b170698c803e49754d Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 12 Jan 2017 06:28:35 +0000 Subject: [PATCH] Add IP addr indexes on comments & artist/artcomm/wikipage versions. --- ...112021922_add_ip_addr_indexes_to_tables.rb | 9 ++++++ db/structure.sql | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 db/migrate/20170112021922_add_ip_addr_indexes_to_tables.rb diff --git a/db/migrate/20170112021922_add_ip_addr_indexes_to_tables.rb b/db/migrate/20170112021922_add_ip_addr_indexes_to_tables.rb new file mode 100644 index 000000000..6e87fe340 --- /dev/null +++ b/db/migrate/20170112021922_add_ip_addr_indexes_to_tables.rb @@ -0,0 +1,9 @@ +class AddIpAddrIndexesToTables < ActiveRecord::Migration + def change + reversible { execute "set statement_timeout = 0" } + add_index :wiki_page_versions, :updater_ip_addr + add_index :artist_commentary_versions, :updater_ip_addr + add_index :artist_versions, :updater_ip_addr + add_index :comments, :ip_addr + end +end diff --git a/db/structure.sql b/db/structure.sql index b0de9eb42..f78d52df7 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4881,6 +4881,13 @@ CREATE INDEX index_artist_commentary_versions_on_post_id ON artist_commentary_ve CREATE INDEX index_artist_commentary_versions_on_updater_id_and_post_id ON artist_commentary_versions USING btree (updater_id, post_id); +-- +-- Name: index_artist_commentary_versions_on_updater_ip_addr; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_artist_commentary_versions_on_updater_ip_addr ON artist_commentary_versions USING btree (updater_ip_addr); + + -- -- Name: index_artist_urls_on_artist_id; Type: INDEX; Schema: public; Owner: - -- @@ -4937,6 +4944,13 @@ CREATE INDEX index_artist_versions_on_name ON artist_versions USING btree (name) CREATE INDEX index_artist_versions_on_updater_id ON artist_versions USING btree (updater_id); +-- +-- Name: index_artist_versions_on_updater_ip_addr; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_artist_versions_on_updater_ip_addr ON artist_versions USING btree (updater_ip_addr); + + -- -- Name: index_artists_on_group_name; Type: INDEX; Schema: public; Owner: - -- @@ -5035,6 +5049,13 @@ CREATE INDEX index_comments_on_body_index ON comments USING gin (body_index); CREATE INDEX index_comments_on_creator_id_and_post_id ON comments USING btree (creator_id, post_id); +-- +-- Name: index_comments_on_ip_addr; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_comments_on_ip_addr ON comments USING btree (ip_addr); + + -- -- Name: index_comments_on_post_id; Type: INDEX; Schema: public; Owner: - -- @@ -7051,6 +7072,13 @@ CREATE INDEX index_users_on_last_ip_addr ON users USING btree (last_ip_addr) WHE CREATE UNIQUE INDEX index_users_on_name ON users USING btree (lower((name)::text)); +-- +-- Name: index_wiki_page_versions_on_updater_ip_addr; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_wiki_page_versions_on_updater_ip_addr ON wiki_page_versions USING btree (updater_ip_addr); + + -- -- Name: index_wiki_page_versions_on_wiki_page_id; Type: INDEX; Schema: public; Owner: - -- @@ -7409,3 +7437,4 @@ INSERT INTO schema_migrations (version) VALUES ('20161229001201'); INSERT INTO schema_migrations (version) VALUES ('20170106012138'); +INSERT INTO schema_migrations (version) VALUES ('20170112021922');