about summary refs log tree commit diff
path: root/db/migrate/20171026200500_en_to_en_cy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20171026200500_en_to_en_cy.rb')
-rw-r--r--db/migrate/20171026200500_en_to_en_cy.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20171026200500_en_to_en_cy.rb b/db/migrate/20171026200500_en_to_en_cy.rb
new file mode 100644
index 000000000..0035e1dcd
--- /dev/null
+++ b/db/migrate/20171026200500_en_to_en_cy.rb
@@ -0,0 +1,17 @@
+class EnToEnCy < ActiveRecord::Migration[5.1]
+  def up
+    User.find_each do |user|
+      if user.locale == 'en'
+        user.update(locale: 'en-CY')
+      end
+    end
+  end
+
+  def down
+    User.find_each do |user|
+      if user.locale == 'en-CY'
+        user.update(locale: 'en')
+      end
+    end
+  end
+end