diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-19 20:30:59 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-19 20:30:59 +0300 |
commit | 4f44455626a567c939bf6f84684e8879ce2db829 (patch) | |
tree | ead6521f29b5d0f2e194a2aaea7becb3007fcbb0 /db/migrate/20160119111158_add_services_category.rb | |
parent | 98e1a5b63424b6912de98ee5055d3f9e57e63899 (diff) | |
parent | c8d66514efcf946f847cb3120b271d8f0f0327f2 (diff) |
Merge branch 'master' into user-ldap-email
# Conflicts:
# db/schema.rb
Diffstat (limited to 'db/migrate/20160119111158_add_services_category.rb')
-rw-r--r-- | db/migrate/20160119111158_add_services_category.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/db/migrate/20160119111158_add_services_category.rb b/db/migrate/20160119111158_add_services_category.rb new file mode 100644 index 00000000000..a9110a8418b --- /dev/null +++ b/db/migrate/20160119111158_add_services_category.rb @@ -0,0 +1,39 @@ +class AddServicesCategory < ActiveRecord::Migration + def up + add_column :services, :category, :string, default: 'common', null: false + + category = quote_column_name('category') + type = quote_column_name('type') + + execute <<-EOF +UPDATE services +SET #{category} = 'issue_tracker' +WHERE #{type} IN ( + 'CustomIssueTrackerService', + 'GitlabIssueTrackerService', + 'IssueTrackerService', + 'JiraService', + 'RedmineService' +); +EOF + + execute <<-EOF +UPDATE services +SET #{category} = 'ci' +WHERE #{type} IN ( + 'BambooService', + 'BuildkiteService', + 'CiService', + 'DroneCiService', + 'GitlabCiService', + 'TeamcityService' +); + EOF + + add_index :services, :category + end + + def down + remove_column :services, :category + end +end |