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
7782b276
Commit
7782b276
authored
Jan 27, 2021
by
Markus Koller
Committed by
Steve Abrams
Jan 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unique index on services project_id and type
This replaces the previous non-unique index on the same columns.
parent
241626b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
1 deletion
+47
-1
changelogs/unreleased/207385-services-unique-constraint-on-type.yml
.../unreleased/207385-services-unique-constraint-on-type.yml
+5
-0
db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb
...26091713_add_unique_index_services_project_id_and_type.rb
+19
-0
db/migrate/20210126092102_remove_index_services_project_id_and_type.rb
...210126092102_remove_index_services_project_id_and_type.rb
+20
-0
db/schema_migrations/20210126091713
db/schema_migrations/20210126091713
+1
-0
db/schema_migrations/20210126092102
db/schema_migrations/20210126092102
+1
-0
db/structure.sql
db/structure.sql
+1
-1
No files found.
changelogs/unreleased/207385-services-unique-constraint-on-type.yml
0 → 100644
View file @
7782b276
---
title
:
Add unique index on services project_id and type
merge_request
:
52563
author
:
type
:
changed
db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb
0 → 100644
View file @
7782b276
# frozen_string_literal: true
class
AddUniqueIndexServicesProjectIdAndType
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
INDEX_NAME
=
'index_services_on_project_id_and_type_unique'
def
up
add_concurrent_index
:services
,
[
:project_id
,
:type
],
name:
INDEX_NAME
,
unique:
true
end
def
down
remove_concurrent_index_by_name
:services
,
name:
INDEX_NAME
end
end
db/migrate/20210126092102_remove_index_services_project_id_and_type.rb
0 → 100644
View file @
7782b276
# frozen_string_literal: true
class
RemoveIndexServicesProjectIdAndType
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
INDEX_NAME
=
'index_services_on_project_id_and_type'
# Replaced by the index added in 20210126091713_add_unique_index_services_project_id_and_type.rb
def
up
remove_concurrent_index_by_name
:services
,
name:
INDEX_NAME
end
def
down
add_concurrent_index
:services
,
[
:project_id
,
:type
],
name:
INDEX_NAME
end
end
db/schema_migrations/20210126091713
0 → 100644
View file @
7782b276
3906739d07514e6e59f79a4a81d28859a2481614a299c95ec1b1d9825a07ec64
\ No newline at end of file
db/schema_migrations/20210126092102
0 → 100644
View file @
7782b276
124c5ae1a1ccade5dec01f72b726e03febc8f56411d7d8990f976bb2a9516037
\ No newline at end of file
db/structure.sql
View file @
7782b276
...
...
@@ -23003,7 +23003,7 @@ CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON
CREATE
INDEX
index_services_on_inherit_from_id
ON
services
USING
btree
(
inherit_from_id
);
CREATE
INDEX
index_services_on_project_id_and_typ
e
ON
services
USING
btree
(
project_id
,
type
);
CREATE
UNIQUE
INDEX
index_services_on_project_id_and_type_uniqu
e
ON
services
USING
btree
(
project_id
,
type
);
CREATE
INDEX
index_services_on_template
ON
services
USING
btree
(
template
);
...
...
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