Skip to content
Snippets Groups Projects
Commit 6d811a64 authored by Valery Sizov's avatar Valery Sizov
Browse files

Merge branch 'fix_migration' into 'master'

Fix migration 7.8 and older to 7.10

https://github.com/gitlabhq/gitlab-ci/issues/586

See merge request !85
parents 836ac3db 5329a83f
No related branches found
No related tags found
No related merge requests found
class BuildMissingServices < ActiveRecord::Migration
def up
Project.find_each do |project|
project.build_missing_services if project.respond_to?(:build_missing_services)
# 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment