20160119112418_add_services_default.rb 412 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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