chore(schema): add preferred_domain to users

This commit is contained in:
Colin Darie 2024-03-18 16:32:57 +01:00
parent 62b55f88a0
commit a16f88f8af
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
3 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,9 @@
module DomainMigratableConcern
extend ActiveSupport::Concern
included do
enum preferred_domain: { demarches_gouv_fr: 0, demarches_simplifiees_fr: 1 }, _prefix: true
validates :preferred_domain, inclusion: { in: User.preferred_domains.keys, allow_nil: true }
end
end

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddPreferredDomainToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :preferred_domain, :integer, default: nil
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2024_03_18_134256) do
ActiveRecord::Schema[7.0].define(version: 2024_03_18_152314) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@ -1136,6 +1136,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_03_18_134256) do
t.string "locale"
t.datetime "locked_at", precision: nil
t.string "loged_in_with_france_connect", default: "false"
t.integer "preferred_domain"
t.datetime "remember_created_at", precision: nil
t.bigint "requested_merge_into_id"
t.datetime "reset_password_sent_at", precision: nil