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
390bb6db
Commit
390bb6db
authored
Apr 12, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove uniqueness constraint from url
So that secondaries can use the same URL.
parent
08489450
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
3 deletions
+29
-3
db/schema.rb
db/schema.rb
+0
-1
ee/app/models/geo_node.rb
ee/app/models/geo_node.rb
+1
-1
ee/db/migrate/20190412183653_remove_url_index_from_geo_nodes.rb
...migrate/20190412183653_remove_url_index_from_geo_nodes.rb
+21
-0
ee/spec/models/geo_node_spec.rb
ee/spec/models/geo_node_spec.rb
+7
-1
No files found.
db/schema.rb
View file @
390bb6db
...
@@ -1389,7 +1389,6 @@ ActiveRecord::Schema.define(version: 20190426180107) do
...
@@ -1389,7 +1389,6 @@ ActiveRecord::Schema.define(version: 20190426180107) do
t
.
index
[
"access_key"
],
name:
"index_geo_nodes_on_access_key"
,
using: :btree
t
.
index
[
"access_key"
],
name:
"index_geo_nodes_on_access_key"
,
using: :btree
t
.
index
[
"name"
],
name:
"index_geo_nodes_on_name"
,
unique:
true
,
using: :btree
t
.
index
[
"name"
],
name:
"index_geo_nodes_on_name"
,
unique:
true
,
using: :btree
t
.
index
[
"primary"
],
name:
"index_geo_nodes_on_primary"
,
using: :btree
t
.
index
[
"primary"
],
name:
"index_geo_nodes_on_primary"
,
using: :btree
t
.
index
[
"url"
],
name:
"index_geo_nodes_on_url"
,
unique:
true
,
using: :btree
end
end
create_table
"geo_repositories_changed_events"
,
force: :cascade
do
|
t
|
create_table
"geo_repositories_changed_events"
,
force: :cascade
do
|
t
|
...
...
ee/app/models/geo_node.rb
View file @
390bb6db
...
@@ -16,7 +16,7 @@ class GeoNode < ApplicationRecord
...
@@ -16,7 +16,7 @@ class GeoNode < ApplicationRecord
has_one
:status
,
class_name:
'GeoNodeStatus'
has_one
:status
,
class_name:
'GeoNodeStatus'
validates
:name
,
presence:
true
,
uniqueness:
{
case_sensitive:
false
}
validates
:name
,
presence:
true
,
uniqueness:
{
case_sensitive:
false
}
validates
:url
,
presence:
true
,
uniqueness:
{
case_sensitive:
false
},
addressable_url:
true
validates
:url
,
presence:
true
,
addressable_url:
true
validates
:internal_url
,
addressable_url:
true
,
allow_blank:
true
,
allow_nil:
true
validates
:internal_url
,
addressable_url:
true
,
allow_blank:
true
,
allow_nil:
true
validates
:primary
,
uniqueness:
{
message:
'node already exists'
},
if: :primary
validates
:primary
,
uniqueness:
{
message:
'node already exists'
},
if: :primary
...
...
ee/db/migrate/20190412183653_remove_url_index_from_geo_nodes.rb
0 → 100644
View file @
390bb6db
# 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
RemoveUrlIndexFromGeoNodes
<
ActiveRecord
::
Migration
[
5.0
]
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
def
up
remove_concurrent_index
:geo_nodes
,
:url
end
def
down
add_concurrent_index
:geo_nodes
,
:url
,
unique:
true
end
end
ee/spec/models/geo_node_spec.rb
View file @
390bb6db
...
@@ -32,7 +32,6 @@ describe GeoNode, :geo, type: :model do
...
@@ -32,7 +32,6 @@ describe GeoNode, :geo, type: :model do
it
{
is_expected
.
to
validate_numericality_of
(
:minimum_reverification_interval
).
is_greater_than_or_equal_to
(
1
)
}
it
{
is_expected
.
to
validate_numericality_of
(
:minimum_reverification_interval
).
is_greater_than_or_equal_to
(
1
)
}
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
it
{
is_expected
.
to
validate_presence_of
(
:url
)
}
it
{
is_expected
.
to
validate_presence_of
(
:url
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:url
).
case_insensitive
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:name
).
case_insensitive
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:name
).
case_insensitive
}
context
'when validating primary node'
do
context
'when validating primary node'
do
...
@@ -64,6 +63,13 @@ describe GeoNode, :geo, type: :model do
...
@@ -64,6 +63,13 @@ describe GeoNode, :geo, type: :model do
it
{
is_expected
.
not_to
be_valid
}
it
{
is_expected
.
not_to
be_valid
}
end
end
context
'when an existing GeoNode has the same url but different name'
do
let!
(
:existing
)
{
new_node
}
let
(
:url
)
{
new_node
.
url
}
it
{
is_expected
.
to
be_valid
}
end
end
end
context
'when validating internal_url'
do
context
'when validating internal_url'
do
...
...
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