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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1bf2dacf
Commit
1bf2dacf
authored
Mar 27, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populate merge requests head_pipeline_id
parent
24824cbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
db/post_migrate/20170428170547_add_head_pipeline_for_each_merge_request.rb
...0170428170547_add_head_pipeline_for_each_merge_request.rb
+23
-0
db/schema.rb
db/schema.rb
+1
-1
No files found.
db/post_migrate/20170428170547_add_head_pipeline_for_each_merge_request.rb
0 → 100644
View file @
1bf2dacf
class
AddHeadPipelineForEachMergeRequest
<
ActiveRecord
::
Migration
DOWNTIME
=
false
class
Pipeline
<
ActiveRecord
::
Base
self
.
table_name
=
"ci_pipelines"
def
self
.
last_per_branch
select
(
'ref, MAX(id) as head_id, project_id'
).
group
(
:ref
).
group
(
:project_id
)
end
end
class
MergeRequest
<
ActiveRecord
::
Base
;
end
def
up
Pipeline
.
last_per_branch
.
each
do
|
pipeline
|
mrs
=
MergeRequest
.
where
(
source_branch:
pipeline
.
ref
,
source_project_id:
pipeline
.
project_id
)
mrs
.
update_all
(
head_pipeline_id:
pipeline
.
head_id
)
end
end
def
down
end
end
db/schema.rb
View file @
1bf2dacf
...
...
@@ -114,6 +114,7 @@ ActiveRecord::Schema.define(version: 20170506185517) do
t
.
string
"plantuml_url"
t
.
boolean
"plantuml_enabled"
t
.
integer
"terminal_max_session_time"
,
default:
0
,
null:
false
t
.
string
"default_artifacts_expire_in"
,
default:
"0"
,
null:
false
t
.
integer
"unique_ips_limit_per_user"
t
.
integer
"unique_ips_limit_time_window"
t
.
boolean
"unique_ips_limit_enabled"
,
default:
false
,
null:
false
...
...
@@ -123,7 +124,6 @@ ActiveRecord::Schema.define(version: 20170506185517) do
t
.
integer
"cached_markdown_version"
t
.
boolean
"clientside_sentry_enabled"
,
default:
false
,
null:
false
t
.
string
"clientside_sentry_dsn"
t
.
string
"default_artifacts_expire_in"
,
default:
"0"
,
null:
false
end
create_table
"audit_events"
,
force: :cascade
do
|
t
|
...
...
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