fix(db): add missing foreign key on attachements blob_id

This commit is contained in:
Paul Chavard 2022-09-15 11:28:12 +02:00
parent 84b9644bcd
commit 2485fb67cc
3 changed files with 12 additions and 1 deletions

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.
ActiveRecord::Schema.define(version: 2022_09_03_151920) do
ActiveRecord::Schema.define(version: 2022_09_04_151920) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
@ -869,6 +869,7 @@ ActiveRecord::Schema.define(version: 2022_09_03_151920) do
t.index ["acronym"], name: "index_zones_on_acronym", unique: true
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 "administrateurs", "users"
add_foreign_key "administrateurs_instructeurs", "administrateurs"