Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
9f5b45a573d2
Commit
1859b106
authored
Dec 14, 2015
by
Kamil Trzciński
Browse files
Merge branch 'fix-ci-project-migration' into 'master'
Fix CI project migration and 500 on runners page See merge request !2093
parents
0c21dc075f7c
157f83e2f129
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/views/admin/runners/show.html.haml
View file @
9f5b45a5
...
...
@@ -60,7 +60,7 @@
=
project
.
name_with_namespace
%td
.pull-right
=
link_to
'Disable'
,
[
:admin
,
project
.
namespace
,
project
,
runner_project
],
method: :delete
,
class:
'btn btn-danger btn-xs'
=
link_to
'Disable'
,
[
:admin
,
project
.
namespace
.
becomes
(
Namespace
)
,
project
,
runner_project
],
method: :delete
,
class:
'btn btn-danger btn-xs'
%table
.table
%thead
...
...
app/views/projects/runners/_runner.html.haml
View file @
9f5b45a5
...
...
@@ -18,7 +18,7 @@
-
runner_project
=
@project
.
runner_projects
.
find_by
(
runner_id:
runner
)
=
link_to
'Disable for this project'
,
namespace_project_runner_project_path
(
@project
.
namespace
,
@project
,
runner_project
),
data:
{
confirm:
"Are you sure?"
},
method: :delete
,
class:
'btn btn-danger btn-sm'
-
elsif
runner
.
specific?
=
form_for
[
@project
.
namespace
,
@project
,
@project
.
runner_projects
.
new
]
do
|
f
|
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
)
,
@project
,
@project
.
runner_projects
.
new
]
do
|
f
|
=
f
.
hidden_field
:runner_id
,
value:
runner
.
id
=
f
.
submit
'Enable for this project'
,
class:
'btn btn-sm'
.pull-right
...
...
db/migrate/20151210125930_migrate_ci_to_project.rb
View file @
9f5b45a5
...
...
@@ -27,11 +27,11 @@ def migrate_project_id_for_builds
def
migrate_project_column
(
column
,
new_column
=
nil
)
new_column
||=
column
subquery
=
"SELECT ci_projects.
#{
column
}
FROM ci_projects WHERE projects.id = ci_projects.gitlab_id"
execute
(
"UPDATE projects SET
#{
new_column
}
=(
#{
subquery
}
) WHERE
#{
new_column
}
IS NULL AND
(
#{
subquery
}
) IS NOT NULL"
)
execute
(
"UPDATE projects SET
#{
new_column
}
=(
#{
subquery
}
) WHERE (
#{
subquery
}
) IS NOT NULL"
)
end
def
migrate_ci_service
subquery
=
"SELECT active FROM services WHERE projects.id = services.project_id AND type='GitlabCiService'"
execute
(
"UPDATE projects SET builds_enabled=(
#{
subquery
}
) WHERE
builds_enabled IS NULL AND
(
#{
subquery
}
) IS NOT NULL"
)
subquery
=
"SELECT active FROM services WHERE projects.id = services.project_id AND type='GitlabCiService'
LIMIT 1
"
execute
(
"UPDATE projects SET builds_enabled=(
#{
subquery
}
) WHERE (
#{
subquery
}
) IS NOT NULL"
)
end
end
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