From 630ea22ecefec05a0da8271d6f1ad750338a01da Mon Sep 17 00:00:00 2001 From: taitus Date: Fri, 18 Dec 2020 09:34:36 +0100 Subject: [PATCH] Add new 'subscriptions_token' column to the users' table Giving any user a direct link to edit another user's account settings doesn't seem like a great idea. Instead we'll generate a random secure hash string to help keep things more secure. We'll store these hashes on each user so that we have a way to find them during this public query. To do this we need to add a column to the user table. --- .../20201218082830_add_subscriptions_token_to_users.rb | 5 +++++ db/schema.rb | 1 + 2 files changed, 6 insertions(+) create mode 100644 db/migrate/20201218082830_add_subscriptions_token_to_users.rb diff --git a/db/migrate/20201218082830_add_subscriptions_token_to_users.rb b/db/migrate/20201218082830_add_subscriptions_token_to_users.rb new file mode 100644 index 000000000..5d447d019 --- /dev/null +++ b/db/migrate/20201218082830_add_subscriptions_token_to_users.rb @@ -0,0 +1,5 @@ +class AddSubscriptionsTokenToUsers < ActiveRecord::Migration[5.2] + def change + add_column :users, :subscriptions_token, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 9758897cc..050cb482f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1625,6 +1625,7 @@ ActiveRecord::Schema.define(version: 2021_11_03_112944) do t.boolean "public_interests", default: false t.boolean "recommended_debates", default: true t.boolean "recommended_proposals", default: true + t.string "subscriptions_token" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["date_of_birth"], name: "index_users_on_date_of_birth" t.index ["email"], name: "index_users_on_email", unique: true