Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
a0c2a7b0
Commit
a0c2a7b0
authored
Dec 14, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix migrations [ci skip]
parent
8b4cdc50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
db/migrate/20151209144329_migrate_ci_web_hooks.rb
db/migrate/20151209144329_migrate_ci_web_hooks.rb
+3
-2
db/migrate/20151209145909_migrate_ci_emails.rb
db/migrate/20151209145909_migrate_ci_emails.rb
+2
-2
db/migrate/20151210125232_migrate_ci_slack_service.rb
db/migrate/20151210125232_migrate_ci_slack_service.rb
+7
-3
db/migrate/20151210125927_migrate_ci_hip_chat_service.rb
db/migrate/20151210125927_migrate_ci_hip_chat_service.rb
+7
-3
No files found.
db/migrate/20151209144329_migrate_ci_web_hooks.rb
View file @
a0c2a7b0
...
...
@@ -3,8 +3,9 @@ class MigrateCiWebHooks < ActiveRecord::Migration
def
up
execute
(
'INSERT INTO web_hooks (url, project_id, type, created_at, updated_at, push_events, build_events) '
\
"SELECT ci_web_hooks.url, projects.id, 'ProjectHook', ci_web_hooks.created_at, ci_web_hooks.updated_at,
#{
false_value
}
,
#{
true_value
}
FROM ci_web_hooks "
\
'INSERT INTO web_hooks (url, project_id, type, created_at, updated_at, push_events, issues_events, merge_requests_events, tag_push_events, note_events, build_events) '
\
"SELECT ci_web_hooks.url, projects.id, 'ProjectHook', ci_web_hooks.created_at, ci_web_hooks.updated_at, "
\
"
#{
false_value
}
,
#{
false_value
}
,
#{
false_value
}
,
#{
false_value
}
,
#{
false_value
}
,
#{
true_value
}
FROM ci_web_hooks "
\
'JOIN ci_projects ON ci_web_hooks.project_id = ci_projects.id '
\
'JOIN projects ON ci_projects.gitlab_id = projects.id'
)
...
...
db/migrate/20151209145909_migrate_ci_emails.rb
View file @
a0c2a7b0
...
...
@@ -30,9 +30,9 @@ class MigrateCiEmails < ActiveRecord::Migration
# This function returns 0 or 1 for column
def
convert_bool
(
name
)
if
self
.
postgresql?
if
Gitlab
::
Database
.
postgresql?
# PostgreSQL uses BOOLEAN type
"CASE WHEN
#{
name
}
IS TRUE THEN '1' ELSE '0' END
;
"
"CASE WHEN
#{
name
}
IS TRUE THEN '1' ELSE '0' END"
else
# MySQL uses TINYINT
"
#{
name
}
"
...
...
db/migrate/20151210125232_migrate_ci_slack_service.rb
View file @
a0c2a7b0
...
...
@@ -4,16 +4,20 @@ class MigrateCiSlackService < ActiveRecord::Migration
def
up
properties_query
=
'SELECT properties 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::SlackService' 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::SlackService' AND ci_services.active"
"WHERE ci_projects.gitlab_id=services.project_id AND ci_services.type='Ci::SlackService' 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='SlackService' AND (
#{
active_query
}
) IS NOT NULL"
)
...
...
db/migrate/20151210125927_migrate_ci_hip_chat_service.rb
View file @
a0c2a7b0
...
...
@@ -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"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment