Merge pull request #7637 from tchak/chore-add-missing-foreign-keys

fix(db): add missing foreign keys
This commit is contained in:
Paul Chavard 2022-09-20 15:27:53 +02:00 committed by GitHub
commit b21ee46dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 123 additions and 75 deletions

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champ < ApplicationRecord class Champ < ApplicationRecord
belongs_to :dossier, inverse_of: false, touch: true, optional: false belongs_to :dossier, inverse_of: false, touch: true, optional: false

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::AddressChamp < Champs::TextChamp class Champs::AddressChamp < Champs::TextChamp
def full_address? def full_address?

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::AnnuaireEducationChamp < Champs::TextChamp class Champs::AnnuaireEducationChamp < Champs::TextChamp
def fetch_external_data? def fetch_external_data?

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::CarteChamp < Champ class Champs::CarteChamp < Champ
# Default map location. Center of the World, ahm, France... # Default map location. Center of the World, ahm, France...

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::CheckboxChamp < Champs::YesNoChamp class Champs::CheckboxChamp < Champs::YesNoChamp
def true? def true?

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::CiviliteChamp < Champ class Champs::CiviliteChamp < Champ
def html_label? def html_label?

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::CnafChamp < Champs::TextChamp class Champs::CnafChamp < Champs::TextChamp
# see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/cnaf-input-validation.middleware.ts # see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/cnaf-input-validation.middleware.ts

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::CommuneChamp < Champs::TextChamp class Champs::CommuneChamp < Champs::TextChamp
store_accessor :value_json, :departement, :code_departement store_accessor :value_json, :departement, :code_departement

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DateChamp < Champ class Champs::DateChamp < Champ
before_save :format_before_save before_save :format_before_save

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DatetimeChamp < Champ class Champs::DatetimeChamp < Champ
before_save :format_before_save before_save :format_before_save

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DecimalNumberChamp < Champ class Champs::DecimalNumberChamp < Champ
validates :value, numericality: { validates :value, numericality: {

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DepartementChamp < Champs::TextChamp class Champs::DepartementChamp < Champs::TextChamp
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DgfipChamp < Champs::TextChamp class Champs::DgfipChamp < Champs::TextChamp
# see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/dgfip-input-validation.middleware.ts # see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/dgfip-input-validation.middleware.ts

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DossierLinkChamp < Champ class Champs::DossierLinkChamp < Champ
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::DropDownListChamp < Champ class Champs::DropDownListChamp < Champ
THRESHOLD_NB_OPTIONS_AS_RADIO = 5 THRESHOLD_NB_OPTIONS_AS_RADIO = 5

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::EmailChamp < Champs::TextChamp class Champs::EmailChamp < Champs::TextChamp
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::EngagementChamp < Champs::CheckboxChamp class Champs::EngagementChamp < Champs::CheckboxChamp
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::ExplicationChamp < Champs::TextChamp class Champs::ExplicationChamp < Champs::TextChamp
def search_terms def search_terms

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::HeaderSectionChamp < Champ class Champs::HeaderSectionChamp < Champ
def search_terms def search_terms

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::IbanChamp < Champ class Champs::IbanChamp < Champ
validates_with IbanValidator validates_with IbanValidator

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::IntegerNumberChamp < Champ class Champs::IntegerNumberChamp < Champ
validates :value, numericality: { validates :value, numericality: {

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::LinkedDropDownListChamp < Champ class Champs::LinkedDropDownListChamp < Champ
delegate :primary_options, :secondary_options, to: 'type_de_champ.dynamic_type' delegate :primary_options, :secondary_options, to: 'type_de_champ.dynamic_type'

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::MesriChamp < Champs::TextChamp class Champs::MesriChamp < Champs::TextChamp
# see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/mesri-input-validation.middleware.ts # see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/mesri-input-validation.middleware.ts

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::MultipleDropDownListChamp < Champ class Champs::MultipleDropDownListChamp < Champ
before_save :format_before_save before_save :format_before_save

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::NumberChamp < Champ class Champs::NumberChamp < Champ
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::PaysChamp < Champs::TextChamp class Champs::PaysChamp < Champs::TextChamp
def localized_value def localized_value

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::PhoneChamp < Champs::TextChamp class Champs::PhoneChamp < Champs::TextChamp
# We want to allow: # We want to allow:

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::PieceJustificativeChamp < Champ class Champs::PieceJustificativeChamp < Champ
FILE_MAX_SIZE = 200.megabytes FILE_MAX_SIZE = 200.megabytes

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::PoleEmploiChamp < Champs::TextChamp class Champs::PoleEmploiChamp < Champs::TextChamp
# see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/pole-emploi-input-validation.middleware.ts # see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/pole-emploi-input-validation.middleware.ts

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::RegionChamp < Champs::TextChamp class Champs::RegionChamp < Champs::TextChamp
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::RepetitionChamp < Champ class Champs::RepetitionChamp < Champ
accepts_nested_attributes_for :champs, allow_destroy: true accepts_nested_attributes_for :champs, allow_destroy: true

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::SiretChamp < Champ class Champs::SiretChamp < Champ
def search_terms def search_terms

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::TextChamp < Champ class Champs::TextChamp < Champ
end end

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::TextareaChamp < Champs::TextChamp class Champs::TextareaChamp < Champs::TextChamp
def for_export def for_export

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::TitreIdentiteChamp < Champ class Champs::TitreIdentiteChamp < Champ
FILE_MAX_SIZE = 20.megabytes FILE_MAX_SIZE = 20.megabytes

View file

@ -13,11 +13,11 @@
# value_json :jsonb # value_json :jsonb
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# dossier_id :integer # dossier_id :integer not null
# etablissement_id :integer # etablissement_id :integer
# external_id :string # external_id :string
# parent_id :bigint # parent_id :bigint
# type_de_champ_id :integer # type_de_champ_id :integer not null
# #
class Champs::YesNoChamp < Champ class Champs::YesNoChamp < Champ
def search_terms def search_terms

View file

@ -0,0 +1,11 @@
class AddMissingForeignKeys < ActiveRecord::Migration[6.1]
def change
add_foreign_key :champs, :dossiers, validate: false
add_foreign_key :champs, :types_de_champ, validate: false
add_foreign_key :champs, :etablissements, validate: false
add_foreign_key :etablissements, :dossiers, validate: false
add_check_constraint :champs, "dossier_id IS NOT NULL", name: "champs_dossier_id_null", validate: false
add_check_constraint :champs, "type_de_champ_id IS NOT NULL", name: "champs_type_de_champ_id_null", validate: false
end
end

View file

@ -0,0 +1,8 @@
class ValidateMissingForeignKeys < ActiveRecord::Migration[6.1]
def change
validate_foreign_key :champs, :dossiers
validate_foreign_key :champs, :types_de_champ
validate_foreign_key :champs, :etablissements
validate_foreign_key :etablissements, :dossiers
end
end

View file

@ -0,0 +1,7 @@
class ValidateNotNullChampsTypeDeChampId < ActiveRecord::Migration[6.1]
def change
validate_check_constraint :champs, name: "champs_type_de_champ_id_null"
change_column_null :champs, :type_de_champ_id, false
remove_check_constraint :champs, name: "champs_type_de_champ_id_null"
end
end

View file

@ -0,0 +1,7 @@
class ValidateNotNullChampsDossierId < ActiveRecord::Migration[6.1]
def change
validate_check_constraint :champs, name: "champs_dossier_id_null"
change_column_null :champs, :dossier_id, false
remove_check_constraint :champs, name: "champs_dossier_id_null"
end
end

View file

@ -0,0 +1,5 @@
class AddForeignKeyToAttachmentsBlobId < ActiveRecord::Migration[6.1]
def change
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id, validate: false
end
end

View file

@ -0,0 +1,5 @@
class ValidateForeignKeyOnAttachmentsBlobId < ActiveRecord::Migration[6.1]
def change
validate_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
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: 2022_09_02_151920) do ActiveRecord::Schema.define(version: 2022_09_04_151920) 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 "pgcrypto" enable_extension "pgcrypto"
@ -185,7 +185,7 @@ ActiveRecord::Schema.define(version: 2022_09_02_151920) do
create_table "champs", id: :serial, force: :cascade do |t| create_table "champs", id: :serial, force: :cascade do |t|
t.datetime "created_at" t.datetime "created_at"
t.jsonb "data" t.jsonb "data"
t.integer "dossier_id" t.integer "dossier_id", null: false
t.integer "etablissement_id" t.integer "etablissement_id"
t.string "external_id" t.string "external_id"
t.string "fetch_external_data_exceptions", array: true t.string "fetch_external_data_exceptions", array: true
@ -194,7 +194,7 @@ ActiveRecord::Schema.define(version: 2022_09_02_151920) do
t.datetime "rebased_at" t.datetime "rebased_at"
t.integer "row" t.integer "row"
t.string "type" t.string "type"
t.integer "type_de_champ_id" t.integer "type_de_champ_id", null: false
t.datetime "updated_at" t.datetime "updated_at"
t.string "value" t.string "value"
t.jsonb "value_json" t.jsonb "value_json"
@ -869,6 +869,7 @@ ActiveRecord::Schema.define(version: 2022_09_02_151920) do
t.index ["acronym"], name: "index_zones_on_acronym", unique: true t.index ["acronym"], name: "index_zones_on_acronym", unique: true
end end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "administrateurs", "users" add_foreign_key "administrateurs", "users"
add_foreign_key "administrateurs_instructeurs", "administrateurs" add_foreign_key "administrateurs_instructeurs", "administrateurs"
@ -885,6 +886,9 @@ ActiveRecord::Schema.define(version: 2022_09_02_151920) do
add_foreign_key "bulk_messages_groupe_instructeurs", "bulk_messages" add_foreign_key "bulk_messages_groupe_instructeurs", "bulk_messages"
add_foreign_key "bulk_messages_groupe_instructeurs", "groupe_instructeurs" add_foreign_key "bulk_messages_groupe_instructeurs", "groupe_instructeurs"
add_foreign_key "champs", "champs", column: "parent_id" add_foreign_key "champs", "champs", column: "parent_id"
add_foreign_key "champs", "dossiers"
add_foreign_key "champs", "etablissements"
add_foreign_key "champs", "types_de_champ"
add_foreign_key "closed_mails", "procedures" add_foreign_key "closed_mails", "procedures"
add_foreign_key "commentaires", "dossiers" add_foreign_key "commentaires", "dossiers"
add_foreign_key "commentaires", "experts" add_foreign_key "commentaires", "experts"
@ -894,6 +898,7 @@ ActiveRecord::Schema.define(version: 2022_09_02_151920) do
add_foreign_key "dossiers", "groupe_instructeurs" add_foreign_key "dossiers", "groupe_instructeurs"
add_foreign_key "dossiers", "procedure_revisions", column: "revision_id" add_foreign_key "dossiers", "procedure_revisions", column: "revision_id"
add_foreign_key "dossiers", "users" add_foreign_key "dossiers", "users"
add_foreign_key "etablissements", "dossiers"
add_foreign_key "experts", "users" add_foreign_key "experts", "users"
add_foreign_key "experts_procedures", "experts" add_foreign_key "experts_procedures", "experts"
add_foreign_key "experts_procedures", "procedures" add_foreign_key "experts_procedures", "procedures"