review
This commit is contained in:
parent
c00ca89b20
commit
ba796897ad
|
@ -1,5 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
class MoveSolvedTopicCustomFieldToDiscourseSolvedSolutions < ActiveRecord::Migration[7.1]
|
class MoveSolvedTopicCustomFieldToDiscourseSolvedSolutions < ActiveRecord::Migration[7.1]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
create_table :discourse_solved_solutions do |t|
|
create_table :discourse_solved_solutions do |t|
|
||||||
t.integer :topic_id, null: false
|
t.integer :topic_id, null: false
|
||||||
|
@ -9,9 +11,6 @@ class MoveSolvedTopicCustomFieldToDiscourseSolvedSolutions < ActiveRecord::Migra
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index :discourse_solved_solutions, :topic_id, unique: true
|
|
||||||
add_index :discourse_solved_solutions, :answer_post_id, unique: true
|
|
||||||
|
|
||||||
execute <<-SQL
|
execute <<-SQL
|
||||||
INSERT INTO discourse_solved_solutions (
|
INSERT INTO discourse_solved_solutions (
|
||||||
topic_id,
|
topic_id,
|
||||||
|
@ -36,6 +35,9 @@ class MoveSolvedTopicCustomFieldToDiscourseSolvedSolutions < ActiveRecord::Migra
|
||||||
AND ua.action_type = #{UserAction::SOLVED}
|
AND ua.action_type = #{UserAction::SOLVED}
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
|
add_index :discourse_solved_solutions, :topic_id, unique: true, algorithm: :concurrently
|
||||||
|
add_index :discourse_solved_solutions, :answer_post_id, unique: true, algorithm: :concurrently
|
||||||
|
|
||||||
execute <<-SQL
|
execute <<-SQL
|
||||||
DELETE FROM post_custom_fields
|
DELETE FROM post_custom_fields
|
||||||
WHERE name = 'is_accepted_answer'
|
WHERE name = 'is_accepted_answer'
|
||||||
|
|
Loading…
Reference in New Issue