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
b90bc5ad
Commit
b90bc5ad
authored
3 years ago
by
huzaifaiftikhar1
Committed by
Huzaifa Iftikhar
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RSpecs and make the where condition in migration inline
parent
cec0d009
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
db/post_migrate/20211203091642_add_index_to_projects_on_marked_for_deletion_at.rb
...091642_add_index_to_projects_on_marked_for_deletion_at.rb
+1
-3
spec/migrations/20211203091642_add_index_to_projects_on_marked_for_deletion_at_spec.rb
...2_add_index_to_projects_on_marked_for_deletion_at_spec.rb
+18
-0
No files found.
db/post_migrate/20211203091642_add_index_to_projects_on_marked_for_deletion_at.rb
View file @
b90bc5ad
...
...
@@ -6,9 +6,7 @@ class AddIndexToProjectsOnMarkedForDeletionAt < Gitlab::Database::Migration[1.0]
INDEX_NAME
=
'index_projects_not_aimed_for_deletion'
def
up
marked_for_deletion_is_null
=
'marked_for_deletion_at IS NULL'
add_concurrent_index
:projects
,
:marked_for_deletion_at
,
where:
marked_for_deletion_is_null
,
name:
INDEX_NAME
add_concurrent_index
:projects
,
:marked_for_deletion_at
,
where:
'marked_for_deletion_at IS NULL'
,
name:
INDEX_NAME
end
def
down
...
...
This diff is collapsed.
Click to expand it.
spec/migrations/20211203091642_add_index_to_projects_on_marked_for_deletion_at_spec.rb
0 → 100644
View file @
b90bc5ad
# frozen_string_literal: true
require
'spec_helper'
require_migration!
RSpec
.
describe
AddIndexToProjectsOnMarkedForDeletionAt
do
it
'correctly migrates up and down'
do
reversible_migration
do
|
migration
|
migration
.
before
->
{
expect
(
ActiveRecord
::
Base
.
connection
.
indexes
(
'projects'
).
map
(
&
:name
)).
not_to
include
(
'index_projects_not_aimed_for_deletion'
)
}
migration
.
after
->
{
expect
(
ActiveRecord
::
Base
.
connection
.
indexes
(
'projects'
).
map
(
&
:name
)).
to
include
(
'index_projects_not_aimed_for_deletion'
)
}
end
end
end
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