demarches-normaliennes/db/migrate/20220727084308_add_missing_foreign_keys.rb

12 lines
555 B
Ruby
Raw Normal View History

2022-09-15 11:27:50 +02:00
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