fix sqlite remove template

pull/502/head
Pete Matsyburka 4 months ago
parent 10e4476f4a
commit d0ac4ad222

@ -40,7 +40,7 @@ class Submission < ApplicationRecord
belongs_to :account
belongs_to :created_by_user, class_name: 'User', optional: true
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy if SearchEntry.table_exists?
has_many :submitters, dependent: :destroy
has_many :submission_events, dependent: :destroy

@ -43,7 +43,7 @@ class Submitter < ApplicationRecord
belongs_to :submission
belongs_to :account
has_one :template, through: :submission
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy if SearchEntry.table_exists?
attribute :values, :string, default: -> { {} }
attribute :preferences, :string, default: -> { {} }

@ -44,7 +44,7 @@ class Template < ApplicationRecord
belongs_to :account
belongs_to :folder, class_name: 'TemplateFolder'
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy if SearchEntry.table_exists?
before_validation :maybe_set_default_folder, on: :create

Loading…
Cancel
Save