debian-mirror-gitlab/db/migrate/20160119112418_add_services_default.rb
2019-02-15 15:39:39 +05:30

21 lines
439 B
Ruby

# rubocop:disable all
class AddServicesDefault < ActiveRecord::Migration[4.2]
def up
add_column :services, :default, :boolean, default: false
default = quote_column_name('default')
type = quote_column_name('type')
execute <<-EOF
UPDATE services
SET #{default} = true
WHERE #{type} = 'GitlabIssueTrackerService'
EOF
add_index :services, :default
end
def down
remove_column :services, :default
end
end