diff options
Diffstat (limited to 'db/post_migrate/20210407150240_confirm_support_bot_user.rb')
-rw-r--r-- | db/post_migrate/20210407150240_confirm_support_bot_user.rb | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/db/post_migrate/20210407150240_confirm_support_bot_user.rb b/db/post_migrate/20210407150240_confirm_support_bot_user.rb deleted file mode 100644 index c26ae153128..00000000000 --- a/db/post_migrate/20210407150240_confirm_support_bot_user.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class ConfirmSupportBotUser < ActiveRecord::Migration[6.0] - SUPPORT_BOT_TYPE = 1 - - def up - users = Arel::Table.new(:users) - um = Arel::UpdateManager.new - um.table(users) - .where(users[:user_type].eq(SUPPORT_BOT_TYPE)) - .where(users[:confirmed_at].eq(nil)) - .set([[users[:confirmed_at], Arel::Nodes::NamedFunction.new('COALESCE', [users[:created_at], Arel::Nodes::SqlLiteral.new('NOW()')])]]) - connection.execute(um.to_sql) - end - - def down - # no op - - # The up migration allows for the possibility that the support user might - # have already been manually confirmed. It's not reversible as this data is - # subsequently lost. - end -end |