Skip to content

Commit

Permalink
Merge pull request #8256 from krauselukas/issue_8143
Browse files Browse the repository at this point in the history
Add data migration for attribute default values.
  • Loading branch information
hennevogel committed Sep 3, 2019
2 parents 8a51e90 + c0f2e24 commit 8441d75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/api/db/data/20190902110039_add_attribute_default_values.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class AddAttributeDefaultValues < ActiveRecord::Migration[5.2]
def up
ans = AttribNamespace.where(name: 'OBS').first
return unless ans

at = ans.attrib_types.where(name: 'QualityCategory').first
at.default_values.where(value: 'Development', position: 1).first_or_create if at

at = ans.attrib_types.where(name: 'MaintenanceIdTemplate').first
at.default_values.where(value: '%Y-%C', position: 1).first_or_create if at
end

def down
raise ActiveRecord::IrreversibleMigration
end
end
2 changes: 1 addition & 1 deletion src/api/db/data_schema.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# encoding: UTF-8
DataMigrate::Data.define(version: 20190228170655)
DataMigrate::Data.define(version: 20190902110039)

0 comments on commit 8441d75

Please sign in to comment.