From b5be067c88151f75e09fc7d8b558ad4ccd51867b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 7 Oct 2019 04:14:36 +0200 Subject: Fix existing user records with now-renamed `pt` locale (#12092) Fix #12082 --- db/migrate/20191007013357_update_pt_locales.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrate/20191007013357_update_pt_locales.rb (limited to 'db/migrate') diff --git a/db/migrate/20191007013357_update_pt_locales.rb b/db/migrate/20191007013357_update_pt_locales.rb new file mode 100644 index 000000000..b7288d38a --- /dev/null +++ b/db/migrate/20191007013357_update_pt_locales.rb @@ -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 -- cgit