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
e67a2daf
Commit
e67a2daf
authored
Nov 20, 2019
by
Jason Goodman
Committed by
Andreas Brandl
Nov 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create index on environments project_id, state, environment_type
Replace index on environments project_id and state
parent
b3868525
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
changelogs/unreleased/add-index-on-environment-type.yml
changelogs/unreleased/add-index-on-environment-type.yml
+5
-0
db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
...x_to_environments_on_project_id_state_environment_type.rb
+21
-0
db/schema.rb
db/schema.rb
+2
-2
No files found.
changelogs/unreleased/add-index-on-environment-type.yml
0 → 100644
View file @
e67a2daf
---
title
:
Replace index on environments table project_id and state with project_id, state, and environment_type
merge_request
:
19902
author
:
type
:
performance
db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
0 → 100644
View file @
e67a2daf
# frozen_string_literal: true
class
AddIndexToEnvironmentsOnProjectIdStateEnvironmentType
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
OLD_INDEX_NAME
=
'index_environments_on_project_id_and_state'
.
freeze
NEW_INDEX_NAME
=
'index_environments_on_project_id_state_environment_type'
.
freeze
disable_ddl_transaction!
def
up
add_concurrent_index
(
:environments
,
[
:project_id
,
:state
,
:environment_type
],
name:
NEW_INDEX_NAME
)
remove_concurrent_index_by_name
(
:environments
,
OLD_INDEX_NAME
)
end
def
down
add_concurrent_index
(
:environments
,
[
:project_id
,
:state
],
name:
OLD_INDEX_NAME
)
remove_concurrent_index_by_name
(
:environments
,
NEW_INDEX_NAME
)
end
end
db/schema.rb
View file @
e67a2daf
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019_11_1
5_091425
)
do
ActiveRecord
::
Schema
.
define
(
version:
2019_11_1
8_182722
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
enable_extension
"pg_trgm"
...
@@ -1435,7 +1435,7 @@ ActiveRecord::Schema.define(version: 2019_11_15_091425) do
...
@@ -1435,7 +1435,7 @@ ActiveRecord::Schema.define(version: 2019_11_15_091425) do
t
.
index
[
"name"
],
name:
"index_environments_on_name_varchar_pattern_ops"
,
opclass: :varchar_pattern_ops
t
.
index
[
"name"
],
name:
"index_environments_on_name_varchar_pattern_ops"
,
opclass: :varchar_pattern_ops
t
.
index
[
"project_id"
,
"name"
],
name:
"index_environments_on_project_id_and_name"
,
unique:
true
t
.
index
[
"project_id"
,
"name"
],
name:
"index_environments_on_project_id_and_name"
,
unique:
true
t
.
index
[
"project_id"
,
"slug"
],
name:
"index_environments_on_project_id_and_slug"
,
unique:
true
t
.
index
[
"project_id"
,
"slug"
],
name:
"index_environments_on_project_id_and_slug"
,
unique:
true
t
.
index
[
"project_id"
,
"state"
],
name:
"index_environments_on_project_id_and_stat
e"
t
.
index
[
"project_id"
,
"state"
,
"environment_type"
],
name:
"index_environments_on_project_id_state_environment_typ
e"
end
end
create_table
"epic_issues"
,
id: :serial
,
force: :cascade
do
|
t
|
create_table
"epic_issues"
,
id: :serial
,
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