-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8256 from krauselukas/issue_8143
Add data migration for attribute default values.
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/api/db/data/20190902110039_add_attribute_default_values.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |