demarches-normaliennes/db/migrate/20220727084308_add_missing_foreign_keys.rb
2022-09-20 15:16:52 +02:00

11 lines
555 B
Ruby

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