From 2e4d417de1086788b872f6f9093877944f669518 Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 18 Jan 2012 16:59:06 -0500 Subject: [PATCH] added indexes --- db/migrate/20100204214746_create_posts.rb | 3 ++- db/migrate/20100205162521_create_tags.rb | 1 + db/migrate/20100214080605_create_artist_urls.rb | 3 +++ db/migrate/20100215182234_create_wiki_pages.rb | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/db/migrate/20100204214746_create_posts.rb b/db/migrate/20100204214746_create_posts.rb index dbac9890c..0718d7710 100644 --- a/db/migrate/20100204214746_create_posts.rb +++ b/db/migrate/20100204214746_create_posts.rb @@ -67,7 +67,8 @@ class CreatePosts < ActiveRecord::Migration add_index :posts, :parent_id add_index :posts, :uploader_id add_index :posts, :uploader_ip_addr - + + execute "create index index_posts_on_source_pattern on posts (source text_pattern_ops)" execute "create index index_posts_on_created_at_date on posts (date(created_at))" execute "CREATE INDEX index_posts_on_mpixels ON posts (((image_width * image_height)::numeric / 1000000.0))" diff --git a/db/migrate/20100205162521_create_tags.rb b/db/migrate/20100205162521_create_tags.rb index c3bbe43f8..4502a8f05 100644 --- a/db/migrate/20100205162521_create_tags.rb +++ b/db/migrate/20100205162521_create_tags.rb @@ -10,6 +10,7 @@ class CreateTags < ActiveRecord::Migration end add_index :tags, :name, :unique => true + execute "create index index_tags_on_name_pattern on tags (name text_pattern_ops)" end def self.down diff --git a/db/migrate/20100214080605_create_artist_urls.rb b/db/migrate/20100214080605_create_artist_urls.rb index c76f9151e..b5bcd3eec 100644 --- a/db/migrate/20100214080605_create_artist_urls.rb +++ b/db/migrate/20100214080605_create_artist_urls.rb @@ -10,6 +10,9 @@ class CreateArtistUrls < ActiveRecord::Migration add_index :artist_urls, :artist_id add_index :artist_urls, :normalized_url add_index :artist_urls, :url + + execute "create index index_artist_urls_on_url_pattern on artist_urls (url text_pattern_ops)" + execute "create index index_artist_urls_on_normalized_url_pattern on artist_urls (normalized_url text_pattern_ops)" end def self.down diff --git a/db/migrate/20100215182234_create_wiki_pages.rb b/db/migrate/20100215182234_create_wiki_pages.rb index 03b4e2a24..40523f6a9 100644 --- a/db/migrate/20100215182234_create_wiki_pages.rb +++ b/db/migrate/20100215182234_create_wiki_pages.rb @@ -12,6 +12,7 @@ class CreateWikiPages < ActiveRecord::Migration add_index :wiki_pages, :title, :unique => true execute "CREATE INDEX index_wiki_pages_on_body_index_index ON wiki_pages USING GIN (body_index)" execute "CREATE TRIGGER trigger_wiki_pages_on_update BEFORE INSERT OR UPDATE ON wiki_pages FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'public.danbooru', 'body', 'title')" + execute "create index index_wiki_pages_on_title_pattern on wiki_pages (title text_pattern_ops)" end def self.down