classBuildMissingServices<ActiveRecord::MigrationdefupProject.find_eachdo|project|# Slack service creationslack_service=select_one("SELECT id FROM services WHERE type='SlackService' AND project_id = #{project.id}")unlessslack_serviceexecute("INSERT INTO services (type, project_id, active, properties, created_at, updated_at) \ VALUES ('SlackService', '#{project.id}', false, '{}', NOW(), NOW())")end# Mail service creationmail_service=select_one("SELECT id FROM services WHERE type='MailService' AND project_id = #{project.id}")unlessmail_serviceexecute("INSERT INTO services (type, project_id, active, properties, created_at, updated_at) \ VALUES ('MailService', '#{project.id}', true, '{}', NOW(), NOW())")endendendend