Fix existing user records with now-renamed pt locale (#12092)

Fix #12082
This commit is contained in:
Eugen Rochko 2019-10-07 04:14:36 +02:00 committed by GitHub
parent 8386d9ec10
commit b5be067c88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,11 @@
class UpdatePtLocales < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def up
User.where(locale: 'pt').in_batches.update_all(locale: 'pt-PT')
end
def down
User.where(locale: 'pt-PT').in_batches.update_all(locale: 'pt')
end
end