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

fix migration failing

parent 836ac3db
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