summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200313203550_remove_orphaned_chat_names.rb
blob: 59cd2b31772b2b22a5200631d22590879710e1ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class RemoveOrphanedChatNames < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  def up
    execute("DELETE FROM chat_names WHERE service_id NOT IN(SELECT id FROM services WHERE services.type = 'chat')")
  end

  def down
    say 'Orphaned user chat names were removed as a part of this migration and are non-recoverable'
  end
end