FIX:Add migration to delete tracking state for staged users (#10083)

This commit is contained in:
Bianca Nenciu 2020-06-24 08:58:14 +03:00 committed by GitHub
parent 52278ce6fd
commit 843bf0df75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# frozen_string_literal: true
class DeleteTrackingStateForStagedUsers < ActiveRecord::Migration[6.0]
def up
execute <<~SQL
DELETE FROM category_users
WHERE user_id IN (SELECT id FROM users WHERE staged = true)
SQL
execute <<~SQL
DELETE FROM tag_users
WHERE user_id IN (SELECT id FROM users WHERE staged = true)
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end