diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-26 04:42:46 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-26 04:42:46 +0300 |
commit | 046b28312704f3131e72dcd2dbdacc5264d4aa62 (patch) | |
tree | a8c2b14a6e1db3b662fee2c79af70d9fcb643c2e /db/ci/migrate/20150204001035_build_missing_services.rb | |
parent | e449426a4e7d15cdd582d4f136add52cbfb5e04e (diff) |
Groundwork for merging CI into CE
Diffstat (limited to 'db/ci/migrate/20150204001035_build_missing_services.rb')
-rw-r--r-- | db/ci/migrate/20150204001035_build_missing_services.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/ci/migrate/20150204001035_build_missing_services.rb b/db/ci/migrate/20150204001035_build_missing_services.rb new file mode 100644 index 00000000000..437ad072ead --- /dev/null +++ b/db/ci/migrate/20150204001035_build_missing_services.rb @@ -0,0 +1,21 @@ +class BuildMissingServices < ActiveRecord::Migration + def up + Project.find_each do |project| + # Slack service creation + slack_service = select_one("SELECT id FROM services WHERE type='SlackService' AND project_id = #{project.id}") + + unless slack_service + execute("INSERT INTO services (type, project_id, active, properties, created_at, updated_at) \ + VALUES ('SlackService', '#{project.id}', false, '{}', NOW(), NOW())") + end + + # Mail service creation + mail_service = select_one("SELECT id FROM services WHERE type='MailService' AND project_id = #{project.id}") + + unless mail_service + execute("INSERT INTO services (type, project_id, active, properties, created_at, updated_at) \ + VALUES ('MailService', '#{project.id}', true, '{}', NOW(), NOW())") + end + end + end +end |