FIX: fix ids rake task should be evaluated only once (#76)
Without task('data_explorer:fix_query_ids').clear rake task is evaluated twice
This commit is contained in:
parent
e0e639e70f
commit
b4bdbf7150
|
@ -1,6 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
desc 'Fix query IDs to match the old ones used in the plugin store (q:id)'
|
desc 'Fix query IDs to match the old ones used in the plugin store (q:id)'
|
||||||
|
|
||||||
|
task('data_explorer:fix_query_ids').clear
|
||||||
task 'data_explorer:fix_query_ids' => :environment do
|
task 'data_explorer:fix_query_ids' => :environment do
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
# Only queries with unique title can be fixed
|
# Only queries with unique title can be fixed
|
||||||
|
@ -37,7 +39,7 @@ task 'data_explorer:fix_query_ids' => :environment do
|
||||||
hidden BOOLEAN,
|
hidden BOOLEAN,
|
||||||
created_at TIMESTAMP,
|
created_at TIMESTAMP,
|
||||||
updated_at TIMESTAMP
|
updated_at TIMESTAMP
|
||||||
)
|
) ON COMMIT DROP
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
DB.exec <<-SQL
|
DB.exec <<-SQL
|
||||||
|
@ -45,7 +47,7 @@ task 'data_explorer:fix_query_ids' => :environment do
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
query_id INTEGER,
|
query_id INTEGER,
|
||||||
group_id INTEGER
|
group_id INTEGER
|
||||||
)
|
) ON COMMIT DROP
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
movements.each do |movement|
|
movements.each do |movement|
|
||||||
|
|
Loading…
Reference in New Issue