summaryrefslogtreecommitdiff
path: root/db/migrate/20200311074438_migrate_bot_type_to_user_type.rb
blob: b13842794d3f68c6d8d00de3c3a6c3b1cb2356af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

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

  def up
    execute('UPDATE users SET user_type = bot_type WHERE bot_type IS NOT NULL AND user_type IS NULL')
  end

  def down
    execute('UPDATE users SET user_type = NULL WHERE bot_type IS NOT NULL AND bot_type = user_type')
  end
end