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
d34e8781
Commit
d34e8781
authored
Jun 23, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old project_id index and make sure mysql work
parent
5eb4a472
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
5 deletions
+34
-5
20170622135728_add_unique_constraint_to_ci_variables.rb
...e/20170622135728_add_unique_constraint_to_ci_variables.rb
+14
-4
20170623080805_remove_ci_variables_project_id_index.rb
...te/20170623080805_remove_ci_variables_project_id_index.rb
+19
-0
schema.rb
db/schema.rb
+1
-1
No files found.
db/migrate/20170622135728_add_unique_constraint_to_ci_variables.rb
View file @
d34e8781
...
...
@@ -6,18 +6,28 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
disable_ddl_transaction!
def
up
unless
index_exists?
(
:ci_variables
,
columns
)
add_concurrent_index
(
:ci_variables
,
columns
,
unique:
true
)
unless
this_index_exists?
add_concurrent_index
(
:ci_variables
,
columns
,
name:
index_name
,
unique:
true
)
end
end
def
down
if
index_exists?
(
:ci_variables
,
columns
)
&&
Gitlab
::
Database
.
postgresql?
remove_concurrent_index
(
:ci_variables
,
columns
)
if
this_index_exists?
&&
Gitlab
::
Database
.
postgresql?
remove_concurrent_index
(
:ci_variables
,
columns
,
name:
index_name
)
end
end
private
def
this_index_exists?
index_exists?
(
:ci_variables
,
name:
index_name
)
end
def
columns
@columns
||=
[
:project_id
,
:key
,
:environment_scope
]
end
def
index_name
'index_ci_variables_on_project_id_and_key_and_environment_scope'
end
end
db/migrate/20170623080805_remove_ci_variables_project_id_index.rb
0 → 100644
View file @
d34e8781
class
RemoveCiVariablesProjectIdIndex
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
if
index_exists?
(
:ci_variables
,
:project_id
)
remove_concurrent_index
(
:ci_variables
,
:project_id
)
end
end
def
down
unless
index_exists?
(
:ci_variables
,
:project_id
)
add_concurrent_index
(
:ci_variables
,
:project_id
)
end
end
end
db/schema.rb
View file @
d34e8781
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2017062
2135728
)
do
ActiveRecord
::
Schema
.
define
(
version:
2017062
3080805
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
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