mirror of
https://github.com/discourse/discourse-data-explorer.git
synced 2025-03-09 13:24:53 +00:00
FIX: rubocop in fix query ids migration
This commit is contained in:
parent
856f00c1c7
commit
933fd9ac46
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class FixQueryIds < ActiveRecord::Migration[6.0]
|
class FixQueryIds < ActiveRecord::Migration[6.0]
|
||||||
def up
|
def up
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
@ -17,7 +19,7 @@ class FixQueryIds < ActiveRecord::Migration[6.0]
|
|||||||
|
|
||||||
# If there are new queries, they still may have conflict
|
# If there are new queries, they still may have conflict
|
||||||
# We just want to move their ids to safe space and we will not move them back
|
# We just want to move their ids to safe space and we will not move them back
|
||||||
additional_conflicts = DB.query(<<~SQL, from: movements.map{ |m| m.from }, to: movements.map { |m| m.to } ).map { |conflict| conflict.id }
|
additional_conflicts = DB.query(<<~SQL, from: movements.map { |m| m.from }, to: movements.map { |m| m.to }).map { |conflict| conflict.id }
|
||||||
SELECT id FROM data_explorer_queries
|
SELECT id FROM data_explorer_queries
|
||||||
WHERE id IN (:to)
|
WHERE id IN (:to)
|
||||||
AND id NOT IN (:from)
|
AND id NOT IN (:from)
|
||||||
@ -37,8 +39,6 @@ class FixQueryIds < ActiveRecord::Migration[6.0]
|
|||||||
)
|
)
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
movements.each do |movement|
|
movements.each do |movement|
|
||||||
# insert moved and conflict queries to temporary table
|
# insert moved and conflict queries to temporary table
|
||||||
DB.exec <<-SQL
|
DB.exec <<-SQL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user