forked from e621ng/e621ng
Update drop post index migration
This commit is contained in:
parent
db44e102c2
commit
a37a346817
@ -1,6 +1,7 @@
|
||||
class DropUnusedPostIndexes < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
def up
|
||||
execute "drop index if exists index_posts_on_source"
|
||||
execute "drop index if exists index_posts_on_source_pattern"
|
||||
remove_index :posts, :image_height
|
||||
remove_index :posts, :image_width
|
||||
remove_index :posts, :file_size
|
||||
@ -8,4 +9,16 @@ class DropUnusedPostIndexes < ActiveRecord::Migration[6.0]
|
||||
remove_index :posts, :last_comment_bumped_at
|
||||
remove_index :posts, :last_noted_at
|
||||
end
|
||||
|
||||
def down
|
||||
execute "CREATE INDEX IF NOT EXISTS index_posts_on_source ON posts USING btree
|
||||
(lower(source))"
|
||||
execute "CREATE INDEX IF NOT EXISTS index_posts_on_source_pattern ON posts USING btree
|
||||
((SourcePattern(lower(source))) text_pattern_ops)"
|
||||
add_index :posts, :image_height
|
||||
add_index :posts, :image_width
|
||||
add_index :posts, :file_size
|
||||
add_index :posts, :last_comment_bumped_at
|
||||
add_index :posts, :last_noted_at
|
||||
end
|
||||
end
|
||||
|
@ -4438,13 +4438,6 @@ CREATE INDEX index_posts_on_parent_id ON public.posts USING btree (parent_id);
|
||||
CREATE INDEX index_posts_on_pixiv_id ON public.posts USING btree (pixiv_id) WHERE (pixiv_id IS NOT NULL);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_source_pattern; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_posts_on_source_pattern ON public.posts USING btree (public.sourcepattern(lower((source)::text)) text_pattern_ops);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_tags_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user