98bb435f42
Migrations shouldn't fail RuboCop checks - especially lint checks, such as the nested method check. To avoid changing code in existing migrations, add the magic comment to the top of each of them to skip that file.
21 lines
434 B
Ruby
21 lines
434 B
Ruby
# rubocop:disable all
|
|
class AddServicesDefault < ActiveRecord::Migration
|
|
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
|