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
52db12ee
Commit
52db12ee
authored
Dec 06, 2019
by
charlie ablett
Committed by
Mayra Cabrera
Dec 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add two partial indexes
- Non-unique
parent
6e5c3129
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
changelogs/unreleased/30390-cablett-duplicate-labels-nonunique-index.yml
...leased/30390-cablett-duplicate-labels-nonunique-index.yml
+5
-0
db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
...20191204093410_add_label_project_group_partial_indexes.rb
+25
-0
db/schema.rb
db/schema.rb
+3
-1
No files found.
changelogs/unreleased/30390-cablett-duplicate-labels-nonunique-index.yml
0 → 100644
View file @
52db12ee
---
title
:
Add nonunique indexes to Labels
merge_request
:
21230
author
:
type
:
fixed
db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
0 → 100644
View file @
52db12ee
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddLabelProjectGroupPartialIndexes
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
PROJECT_AND_TITLE
=
[
:project_id
,
:title
]
GROUP_AND_TITLE
=
[
:group_id
,
:title
]
def
up
add_concurrent_index
:labels
,
PROJECT_AND_TITLE
,
unique:
false
,
where:
"labels.group_id = null"
add_concurrent_index
:labels
,
GROUP_AND_TITLE
,
unique:
false
,
where:
"labels.project_id = null"
end
def
down
remove_concurrent_index
:labels
,
PROJECT_AND_TITLE
remove_concurrent_index
:labels
,
GROUP_AND_TITLE
end
end
db/schema.rb
View file @
52db12ee
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019_12_04_0
70713
)
do
ActiveRecord
::
Schema
.
define
(
version:
2019_12_04_0
93410
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
...
...
@@ -2228,6 +2228,8 @@ ActiveRecord::Schema.define(version: 2019_12_04_070713) do
t
.
integer
"group_id"
t
.
integer
"cached_markdown_version"
t
.
index
[
"group_id"
,
"project_id"
,
"title"
],
name:
"index_labels_on_group_id_and_project_id_and_title"
,
unique:
true
t
.
index
[
"group_id"
,
"title"
],
name:
"index_labels_on_group_id_and_title"
,
where:
"(project_id = NULL::integer)"
t
.
index
[
"project_id"
,
"title"
],
name:
"index_labels_on_project_id_and_title"
,
where:
"(group_id = NULL::integer)"
t
.
index
[
"project_id"
],
name:
"index_labels_on_project_id"
t
.
index
[
"template"
],
name:
"index_labels_on_template"
,
where:
"template"
t
.
index
[
"title"
],
name:
"index_labels_on_title"
...
...
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