about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190531082330_add_vars_to_users.rb5
-rw-r--r--db/migrate/20190531082452_move_account_vars_to_users.rb5
-rw-r--r--db/schema.rb1
3 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20190531082330_add_vars_to_users.rb b/db/migrate/20190531082330_add_vars_to_users.rb
new file mode 100644
index 000000000..c3937a350
--- /dev/null
+++ b/db/migrate/20190531082330_add_vars_to_users.rb
@@ -0,0 +1,5 @@
+class AddVarsToUsers < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured { add_column :users, :vars, :jsonb, null:false, default: {} }
+  end
+end
diff --git a/db/migrate/20190531082452_move_account_vars_to_users.rb b/db/migrate/20190531082452_move_account_vars_to_users.rb
new file mode 100644
index 000000000..fea150b78
--- /dev/null
+++ b/db/migrate/20190531082452_move_account_vars_to_users.rb
@@ -0,0 +1,5 @@
+class MoveAccountVarsToUsers < ActiveRecord::Migration[5.2]
+  def up
+    Account.local.find_each { |a| a.user.vars = a.vars; a.user.save }
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 5c4360422..2ccbf9e9f 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -762,6 +762,7 @@ ActiveRecord::Schema.define(version: 2019_05_21_003909) do
     t.string "chosen_languages", array: true
     t.bigint "created_by_application_id"
     t.boolean "approved", default: true, null: false
+    t.jsonb "vars", default: {}, null: false
     t.index ["account_id"], name: "index_users_on_account_id"
     t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
     t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id"