mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 04:03:45 +08:00
Migration fixes [SCI-7046] (#4321)
This commit is contained in:
parent
eb619184a5
commit
464f9935a4
2 changed files with 4 additions and 2 deletions
|
@ -40,7 +40,7 @@ class LabelTemplate < ApplicationRecord
|
|||
private
|
||||
|
||||
def ensure_single_default_template!
|
||||
if default && self.class.where(team_id: team_id, default: true, language_type: language_type)
|
||||
if default && self.class.where(team_id: team_id, default: true, type: type)
|
||||
.where.not(id: id).any?
|
||||
errors.add(:default, I18n.t('activerecord.errors.models.label_template.attributes.default.already_exist'))
|
||||
end
|
||||
|
|
|
@ -11,6 +11,8 @@ class UpdateLabelTemplates < ActiveRecord::Migration[6.1]
|
|||
t.remove :size
|
||||
end
|
||||
|
||||
LabelTemplate.reset_column_information
|
||||
|
||||
# Remove our original default template
|
||||
LabelTemplate.order(created_at: :asc).find_by(default: true)&.destroy
|
||||
|
||||
|
@ -21,7 +23,7 @@ class UpdateLabelTemplates < ActiveRecord::Migration[6.1]
|
|||
change_table :label_templates, bulk: true do |t|
|
||||
t.remove :type
|
||||
t.remove :width_mm
|
||||
t.remoe :height_mm
|
||||
t.remove :height_mm
|
||||
t.string :format, null: false, default: 'ZPL'
|
||||
t.integer :language_type
|
||||
t.string :size
|
||||
|
|
Loading…
Reference in a new issue