[fix #6084] add db constraints to france_connect_informations table

This commit is contained in:
simon lehericey 2021-04-12 15:05:05 +02:00
parent b7faed96a3
commit 4dc314d24b
3 changed files with 16 additions and 7 deletions

View file

@ -10,10 +10,10 @@
# family_name :string # family_name :string
# gender :string # gender :string
# given_name :string # given_name :string
# created_at :datetime # created_at :datetime not null
# updated_at :datetime # updated_at :datetime not null
# france_connect_particulier_id :string # france_connect_particulier_id :string
# user_id :integer # user_id :integer not null
# #
class FranceConnectInformation < ApplicationRecord class FranceConnectInformation < ApplicationRecord
belongs_to :user, optional: true belongs_to :user, optional: true

View file

@ -0,0 +1,8 @@
class AddConstraintsToFranceConnectInformations < ActiveRecord::Migration[6.1]
def change
change_column_null :france_connect_informations, :user_id, false
change_column_null :france_connect_informations, :created_at, false
change_column_null :france_connect_informations, :updated_at, false
add_foreign_key :france_connect_informations, :users
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_04_28_114228) do ActiveRecord::Schema.define(version: 2021_05_04_115445) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -429,10 +429,10 @@ ActiveRecord::Schema.define(version: 2021_04_28_114228) do
t.date "birthdate" t.date "birthdate"
t.string "birthplace" t.string "birthplace"
t.string "france_connect_particulier_id" t.string "france_connect_particulier_id"
t.integer "user_id" t.integer "user_id", null: false
t.string "email_france_connect" t.string "email_france_connect"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.jsonb "data" t.jsonb "data"
t.index ["user_id"], name: "index_france_connect_informations_on_user_id" t.index ["user_id"], name: "index_france_connect_informations_on_user_id"
end end
@ -773,6 +773,7 @@ ActiveRecord::Schema.define(version: 2021_04_28_114228) do
add_foreign_key "experts_procedures", "experts" add_foreign_key "experts_procedures", "experts"
add_foreign_key "experts_procedures", "procedures" add_foreign_key "experts_procedures", "procedures"
add_foreign_key "feedbacks", "users" add_foreign_key "feedbacks", "users"
add_foreign_key "france_connect_informations", "users"
add_foreign_key "geo_areas", "champs" add_foreign_key "geo_areas", "champs"
add_foreign_key "groupe_instructeurs", "procedures" add_foreign_key "groupe_instructeurs", "procedures"
add_foreign_key "initiated_mails", "procedures" add_foreign_key "initiated_mails", "procedures"