Skip to content

Commit

Permalink
Update default of internal attribute in service template
Browse files Browse the repository at this point in the history
  • Loading branch information
hsong-rh committed Aug 10, 2018
1 parent 46a826e commit 6aaf80a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions db/migrate/20180810144738_update_default_internal_attribute.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class UpdateDefaultInternalAttribute < ActiveRecord::Migration[5.0]
class ServiceTemplate < ActiveRecord::Base
self.inheritance_column = :_type_disabled

include MigrationStubHelper
end

def up
change_column :service_templates, :internal, :boolean
say_with_time("Set ServiceTemplate internal") do
ServiceTemplate.where.not(:type => "ServiceTemplateTransformationPlan").update_all(:internal => false)
end
end

def down
change_column :service_templates, :internal, :boolean
say_with_time("Set ServiceTemplate internal") do
ServiceTemplate.where.not(:type => "ServiceTemplateTransformationPlan").update_all(:internal => nil)
end
end
end

0 comments on commit 6aaf80a

Please sign in to comment.