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

@ -4,7 +4,7 @@ class StructuredError < ApplicationRecord
belongs_to :error_template
belongs_to :submission
has_many :structured_error_attributes
has_many :structured_error_attributes, dependent: :destroy
def self.create_from_template(template, message_buffer, submission)
create(

View File

@ -15,7 +15,7 @@ class Submission < ApplicationRecord
belongs_to :study_group, optional: true
has_many :testruns
has_many :structured_errors
has_many :structured_errors, dependent: :destroy
has_many :comments, through: :files
belongs_to :external_users, lambda {