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
d61cc087
Commit
d61cc087
authored
4 years ago
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new index name and create before removing
parent
6584ba00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
db/migrate/20200706035141_adjust_unique_index_alert_management_alerts.rb
...0706035141_adjust_unique_index_alert_management_alerts.rb
+3
-2
db/structure.sql
db/structure.sql
+2
-2
No files found.
db/migrate/20200706035141_adjust_unique_index_alert_management_alerts.rb
View file @
d61cc087
...
...
@@ -5,17 +5,18 @@ class AdjustUniqueIndexAlertManagementAlerts < ActiveRecord::Migration[6.0]
DOWNTIME
=
false
INDEX_NAME
=
'index_alert_management_alerts_on_project_id_and_fingerprint'
NEW_INDEX_NAME
=
'index_partial_am_alerts_on_project_id_and_fingerprint'
RESOLVED_STATUS
=
2
# rubocop:disable Migration/RemoveIndex
# rubocop:disable Migration/AddIndex
def
up
add_index
(
:alert_management_alerts
,
%w(project_id fingerprint)
,
where:
"status <> '
#{
RESOLVED_STATUS
}
'"
,
name:
NEW_INDEX_NAME
,
unique:
true
,
using: :btree
)
remove_index
:alert_management_alerts
,
name:
INDEX_NAME
add_index
(
:alert_management_alerts
,
%w(project_id fingerprint)
,
where:
"status <> '
#{
RESOLVED_STATUS
}
'"
,
name:
INDEX_NAME
,
unique:
true
,
using: :btree
)
end
def
down
remove_index
:alert_management_alerts
,
name:
INDEX_NAME
remove_index
:alert_management_alerts
,
name:
NEW_
INDEX_NAME
add_index
(
:alert_management_alerts
,
%w(project_id fingerprint)
,
name:
INDEX_NAME
,
unique:
true
,
using: :btree
)
end
# rubocop:enable Migration/RemoveIndex
...
...
This diff is collapsed.
Click to expand it.
db/structure.sql
View file @
d61cc087
...
...
@@ -18695,8 +18695,6 @@ CREATE INDEX index_alert_management_alerts_on_environment_id ON public.alert_man
CREATE
INDEX
index_alert_management_alerts_on_issue_id
ON
public
.
alert_management_alerts
USING
btree
(
issue_id
);
CREATE
UNIQUE
INDEX
index_alert_management_alerts_on_project_id_and_fingerprint
ON
public
.
alert_management_alerts
USING
btree
(
project_id
,
fingerprint
)
WHERE
(
status
<>
'2'
::
smallint
);
CREATE
UNIQUE
INDEX
index_alert_management_alerts_on_project_id_and_iid
ON
public
.
alert_management_alerts
USING
btree
(
project_id
,
iid
);
CREATE
INDEX
index_alert_management_alerts_on_prometheus_alert_id
ON
public
.
alert_management_alerts
USING
btree
(
prometheus_alert_id
)
WHERE
(
prometheus_alert_id
IS
NOT
NULL
);
...
...
@@ -19945,6 +19943,8 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON public.page
CREATE
INDEX
index_pages_domains_on_wildcard
ON
public
.
pages_domains
USING
btree
(
wildcard
);
CREATE
UNIQUE
INDEX
index_partial_am_alerts_on_project_id_and_fingerprint
ON
public
.
alert_management_alerts
USING
btree
(
project_id
,
fingerprint
)
WHERE
(
status
<>
'2'
::
smallint
);
CREATE
UNIQUE
INDEX
index_partitioned_foreign_keys_unique_index
ON
public
.
partitioned_foreign_keys
USING
btree
(
to_table
,
from_table
,
from_column
);
CREATE
INDEX
index_pat_on_user_id_and_expires_at
ON
public
.
personal_access_tokens
USING
btree
(
user_id
,
expires_at
);
...
...
This diff is collapsed.
Click to expand it.
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