diff --git a/db/migrate/20180810144738_update_default_internal_attribute.rb b/db/migrate/20180810144738_update_default_internal_attribute.rb new file mode 100644 index 000000000..957175971 --- /dev/null +++ b/db/migrate/20180810144738_update_default_internal_attribute.rb @@ -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