mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 19:33:41 +08:00
36 lines
936 B
Ruby
36 lines
936 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class ReplacePostReplyIndex < ActiveRecord::Migration[7.0]
|
||
|
disable_ddl_transaction!
|
||
|
|
||
|
def up
|
||
|
execute <<~SQL
|
||
|
DROP INDEX CONCURRENTLY IF EXISTS "index_posts_on_topic_id_and_reply_to_post_number"
|
||
|
SQL
|
||
|
|
||
|
execute <<~SQL
|
||
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS "index_posts_on_topic_id_and_reply_to_post_number"
|
||
|
ON "posts" ("topic_id", "reply_to_post_number")
|
||
|
SQL
|
||
|
|
||
|
execute <<~SQL
|
||
|
DROP INDEX CONCURRENTLY IF EXISTS "index_posts_on_reply_to_post_number"
|
||
|
SQL
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
execute <<~SQL
|
||
|
DROP INDEX CONCURRENTLY IF EXISTS "index_posts_on_reply_to_post_number"
|
||
|
SQL
|
||
|
|
||
|
execute <<~SQL
|
||
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS "index_posts_on_reply_to_post_number"
|
||
|
ON "posts" ("reply_to_post_number")
|
||
|
SQL
|
||
|
|
||
|
execute <<~SQL
|
||
|
DROP INDEX CONCURRENTLY IF EXISTS "index_posts_on_topic_id_and_reply_to_post_number"
|
||
|
SQL
|
||
|
end
|
||
|
end
|