Add foreign keys and an index to StructuredError(Attributes)

These changes will ensure a better data consistency and faster access. We further ensure that records should be deleted properly.
This commit is contained in:
Sebastian Serth
2023-03-20 23:50:12 +01:00
parent 5a36e57b9f
commit e3e6fc3af1
5 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
class AddForeignKeysToStructuredErrors < ActiveRecord::Migration[7.0]
def change
add_foreign_key :structured_errors, :submissions
add_foreign_key :structured_errors, :error_templates
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddForeignKeysAndIndexToStructuredErrorAttributes < ActiveRecord::Migration[7.0]
def change
add_foreign_key :structured_error_attributes, :structured_errors
add_foreign_key :structured_error_attributes, :error_template_attributes
add_index :structured_error_attributes, :structured_error_id
end
end