BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
078638a6
Commit
078638a6
authored
May 23, 2017
by
Kushal Pandya
Committed by
kushalpandya
May 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'fix-retried-for-postgres' into 'master'
Fix migrations for older PostgreSQL versions Closes #32721 See merge request !11620
parent
d753c1c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
fix-migration-for-postgres.yml
changelogs/unreleased/fix-migration-for-postgres.yml
+4
-0
20170503004427_update_retried_for_ci_build.rb
...ost_migrate/20170503004427_update_retried_for_ci_build.rb
+6
-4
update_retried_for_ci_builds_spec.rb
spec/migrations/update_retried_for_ci_builds_spec.rb
+2
-2
No files found.
.gitlab-ci.yml
View file @
078638a6
...
...
@@ -51,7 +51,7 @@ stages:
.use-pg
:
&use-pg
services
:
-
postgres:
latest
-
postgres:
9.2
-
redis:alpine
.use-mysql
:
&use-mysql
...
...
changelogs/unreleased/fix-migration-for-postgres.yml
0 → 100644
View file @
078638a6
---
title
:
Fix migration for older PostgreSQL versions
merge_request
:
author
:
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
→
db/post_migrate/20170503004427_up
d
ate_retried_for_ci_build.rb
View file @
078638a6
class
UpateRetriedForCiBuild
<
ActiveRecord
::
Migration
class
Up
d
ateRetriedForCiBuild
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
...
...
@@ -54,13 +54,15 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration
def
with_temporary_partial_index
if
Gitlab
::
Database
.
postgresql?
execute
'CREATE INDEX CONCURRENTLY IF NOT EXISTS index_for_ci_builds_retried_migration ON ci_builds (id) WHERE retried IS NULL;'
unless
index_exists?
(
:ci_builds
,
name: :index_for_ci_builds_retried_migration
)
execute
'CREATE INDEX CONCURRENTLY index_for_ci_builds_retried_migration ON ci_builds (id) WHERE retried IS NULL;'
end
end
yield
if
Gitlab
::
Database
.
postgresql?
execute
'DROP INDEX CONCURRENTLY
IF EXISTS
index_for_ci_builds_retried_migration'
if
Gitlab
::
Database
.
postgresql?
&&
index_exists?
(
:ci_builds
,
name: :index_for_ci_builds_retried_migration
)
execute
'DROP INDEX CONCURRENTLY index_for_ci_builds_retried_migration'
end
end
end
spec/migrations/upate_retried_for_ci_builds_spec.rb
→
spec/migrations/up
d
ate_retried_for_ci_builds_spec.rb
View file @
078638a6
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170503004427_upate_retried_for_ci_build.rb'
)
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170503004427_up
d
ate_retried_for_ci_build.rb'
)
describe
UpateRetriedForCiBuild
,
truncate:
true
do
describe
Up
d
ateRetriedForCiBuild
,
truncate:
true
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let!
(
:build_old
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'test'
)
}
let!
(
:build_new
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'test'
)
}
...
...
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