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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
739e7975
Commit
739e7975
authored
May 02, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add indices for auto_canceled_by_id for PostgreSQL
parent
98ae016a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
1 deletion
+49
-1
changelogs/unreleased/add-index-for-auto_canceled_by_id-mysql.yml
...gs/unreleased/add-index-for-auto_canceled_by_id-mysql.yml
+4
-0
db/migrate/20170502135553_create_index_ci_pipelines_auto_canceled_by_id.rb
...02135553_create_index_ci_pipelines_auto_canceled_by_id.rb
+21
-0
db/migrate/20170502140503_create_index_ci_builds_auto_canceled_by_id.rb
...70502140503_create_index_ci_builds_auto_canceled_by_id.rb
+21
-0
db/schema.rb
db/schema.rb
+3
-1
No files found.
changelogs/unreleased/add-index-for-auto_canceled_by_id-mysql.yml
0 → 100644
View file @
739e7975
---
title
:
Add indices for auto_canceled_by_id for ci_pipelines and ci_builds on PostgreSQL
merge_request
:
11034
author
:
db/migrate/20170502135553_create_index_ci_pipelines_auto_canceled_by_id.rb
0 → 100644
View file @
739e7975
class
CreateIndexCiPipelinesAutoCanceledById
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
# MySQL would already have the index
unless
index_exists?
(
:ci_pipelines
,
:auto_canceled_by_id
)
add_concurrent_index
(
:ci_pipelines
,
:auto_canceled_by_id
)
end
end
def
down
# We cannot remove index for MySQL because it's needed for foreign key
if
Gitlab
::
Database
.
postgresql?
remove_concurrent_index
(
:ci_pipelines
,
:auto_canceled_by_id
)
end
end
end
db/migrate/20170502140503_create_index_ci_builds_auto_canceled_by_id.rb
0 → 100644
View file @
739e7975
class
CreateIndexCiBuildsAutoCanceledById
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
# MySQL would already have the index
unless
index_exists?
(
:ci_builds
,
:auto_canceled_by_id
)
add_concurrent_index
(
:ci_builds
,
:auto_canceled_by_id
)
end
end
def
down
# We cannot remove index for MySQL because it's needed for foreign key
if
Gitlab
::
Database
.
postgresql?
remove_concurrent_index
(
:ci_builds
,
:auto_canceled_by_id
)
end
end
end
db/schema.rb
View file @
739e7975
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20170
426181740
)
do
ActiveRecord
::
Schema
.
define
(
version:
20170
502140503
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -232,6 +232,7 @@ ActiveRecord::Schema.define(version: 20170426181740) do
t
.
integer
"auto_canceled_by_id"
end
add_index
"ci_builds"
,
[
"auto_canceled_by_id"
],
name:
"index_ci_builds_on_auto_canceled_by_id"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"stage_idx"
,
"created_at"
],
name:
"index_ci_builds_on_commit_id_and_stage_idx_and_created_at"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"status"
,
"type"
],
name:
"index_ci_builds_on_commit_id_and_status_and_type"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"type"
,
"name"
,
"ref"
],
name:
"index_ci_builds_on_commit_id_and_type_and_name_and_ref"
,
using: :btree
...
...
@@ -263,6 +264,7 @@ ActiveRecord::Schema.define(version: 20170426181740) do
t
.
integer
"auto_canceled_by_id"
end
add_index
"ci_pipelines"
,
[
"auto_canceled_by_id"
],
name:
"index_ci_pipelines_on_auto_canceled_by_id"
,
using: :btree
add_index
"ci_pipelines"
,
[
"project_id"
,
"ref"
,
"status"
],
name:
"index_ci_pipelines_on_project_id_and_ref_and_status"
,
using: :btree
add_index
"ci_pipelines"
,
[
"project_id"
,
"sha"
],
name:
"index_ci_pipelines_on_project_id_and_sha"
,
using: :btree
add_index
"ci_pipelines"
,
[
"project_id"
],
name:
"index_ci_pipelines_on_project_id"
,
using: :btree
...
...
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