about summary refs log tree commit diff
path: root/db/migrate/20191007013357_update_pt_locales.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20191007013357_update_pt_locales.rb')
-rw-r--r--db/migrate/20191007013357_update_pt_locales.rb11
1 files changed, 11 insertions, 0 deletions
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