diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-14 13:04:47 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-14 13:30:32 +0300 |
commit | a0c2a7b0cbb4567a1f09c4cbc400bf75df47a072 (patch) | |
tree | 4e5489aa993e67889591dfe6b69b071836a1179e /db/migrate/20151210125927_migrate_ci_hip_chat_service.rb | |
parent | 8b4cdc50fca816b4f56f8579e17c4dba836ec797 (diff) |
Fix migrations [ci skip]
Diffstat (limited to 'db/migrate/20151210125927_migrate_ci_hip_chat_service.rb')
-rw-r--r-- | db/migrate/20151210125927_migrate_ci_hip_chat_service.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb b/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb index 2fdaf5fb917..b9e04323576 100644 --- a/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb +++ b/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb @@ -5,16 +5,20 @@ class MigrateCiHipChatService < ActiveRecord::Migration # From properties strip `hipchat_` key properties_query = "SELECT REPLACE(properties, '\"hipchat_', '\"') FROM ci_services " \ 'JOIN ci_projects ON ci_services.project_id=ci_projects.id ' \ - 'WHERE ci_projects.gitlab_id=services.project_id' + "WHERE ci_projects.gitlab_id=services.project_id AND ci_services.type='Ci::HipChatService' AND ci_services.active " \ + 'LIMIT 1' active_query = 'SELECT 1 FROM ci_services ' \ 'JOIN ci_projects ON ci_services.project_id=ci_projects.id ' \ - "WHERE ci_projects.gitlab_id=services.project_id AND ci_services.type='Ci::HipchatService' AND ci_services.active" + "WHERE ci_projects.gitlab_id=services.project_id AND ci_services.type='Ci::HipChatService' AND ci_services.active " \ + 'LIMIT 1' # We update the service since services are always generated for project, even if they are inactive # Activate service and migrate properties if currently the service is not active execute( - "UPDATE services SET properties=(#{properties_query}), build_events=#{true_value}, active=#{true_value} " \ + "UPDATE services SET properties=(#{properties_query}), active=#{true_value}, " \ + "push_events=#{false_value}, issues_events=#{false_value}, merge_requests_events=#{false_value}, " \ + "tag_push_events=#{false_value}, note_events=#{false_value}, build_events=#{true_value} " \ "WHERE NOT services.active AND services.type='HipchatService' AND (#{active_query}) IS NOT NULL" ) |