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
6e5fa040
Commit
6e5fa040
authored
Jun 23, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Geo::RenamedEvent
parent
251fa4c1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
0 deletions
+72
-0
app/models/geo/event_log.rb
app/models/geo/event_log.rb
+4
-0
app/models/geo/repository_renamed_event.rb
app/models/geo/repository_renamed_event.rb
+12
-0
db/migrate/20170623195236_create_geo_repository_renamed_events.rb
...te/20170623195236_create_geo_repository_renamed_events.rb
+21
-0
db/schema.rb
db/schema.rb
+15
-0
spec/models/geo/event_log_spec.rb
spec/models/geo/event_log_spec.rb
+1
-0
spec/models/geo/repository_renamed_event_spec.rb
spec/models/geo/repository_renamed_event_spec.rb
+19
-0
No files found.
app/models/geo/event_log.rb
View file @
6e5fa040
...
@@ -9,5 +9,9 @@ module Geo
...
@@ -9,5 +9,9 @@ module Geo
belongs_to
:repository_deleted_event
,
belongs_to
:repository_deleted_event
,
class_name:
'Geo::RepositoryDeletedEvent'
,
class_name:
'Geo::RepositoryDeletedEvent'
,
foreign_key: :repository_deleted_event_id
foreign_key: :repository_deleted_event_id
belongs_to
:repository_renamed_event
,
class_name:
'Geo::RepositoryRenamedEvent'
,
foreign_key: :repository_renamed_event_id
end
end
end
end
app/models/geo/repository_renamed_event.rb
0 → 100644
View file @
6e5fa040
module
Geo
class
RepositoryRenamedEvent
<
ActiveRecord
::
Base
include
Geo
::
Model
belongs_to
:project
validates
:project
,
:repository_storage_name
,
:repository_storage_path
,
:old_path_with_namespace
,
:new_path_with_namespace
,
:old_wiki_path_with_namespace
,
:new_wiki_path_with_namespace
,
:old_project_name
,
:new_project_name
,
presence:
true
end
end
db/migrate/20170623195236_create_geo_repository_renamed_events.rb
0 → 100644
View file @
6e5fa040
class
CreateGeoRepositoryRenamedEvents
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
create_table
:geo_repository_renamed_events
,
id: :bigserial
do
|
t
|
t
.
references
:project
,
index:
true
,
foreign_key:
{
on_delete: :cascade
},
null:
false
t
.
text
:repository_storage_name
,
null:
false
t
.
text
:repository_storage_path
,
null:
false
t
.
text
:old_path_with_namespace
,
null:
false
t
.
text
:new_path_with_namespace
,
null:
false
t
.
text
:old_wiki_path_with_namespace
,
null:
false
t
.
text
:new_wiki_path_with_namespace
,
null:
false
t
.
text
:old_project_name
,
null:
false
t
.
text
:new_project_name
,
null:
false
end
add_column
:geo_event_log
,
:repository_renamed_event_id
,
:integer
,
limit:
8
end
end
db/schema.rb
View file @
6e5fa040
...
@@ -625,6 +625,20 @@ ActiveRecord::Schema.define(version: 20170627211700) do
...
@@ -625,6 +625,20 @@ ActiveRecord::Schema.define(version: 20170627211700) do
add_index
"geo_repository_deleted_events"
,
[
"project_id"
],
name:
"index_geo_repository_deleted_events_on_project_id"
,
using: :btree
add_index
"geo_repository_deleted_events"
,
[
"project_id"
],
name:
"index_geo_repository_deleted_events_on_project_id"
,
using: :btree
create_table
"geo_repository_renamed_events"
,
id: :bigserial
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
text
"repository_storage_name"
,
null:
false
t
.
text
"repository_storage_path"
,
null:
false
t
.
text
"old_path_with_namespace"
,
null:
false
t
.
text
"new_path_with_namespace"
,
null:
false
t
.
text
"old_wiki_path_with_namespace"
,
null:
false
t
.
text
"new_wiki_path_with_namespace"
,
null:
false
t
.
text
"old_project_name"
,
null:
false
t
.
text
"new_project_name"
,
null:
false
end
add_index
"geo_repository_renamed_events"
,
[
"project_id"
],
name:
"index_geo_repository_renamed_events_on_project_id"
,
using: :btree
create_table
"geo_repository_updated_events"
,
id: :bigserial
,
force: :cascade
do
|
t
|
create_table
"geo_repository_updated_events"
,
id: :bigserial
,
force: :cascade
do
|
t
|
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
integer
"branches_affected"
,
null:
false
t
.
integer
"branches_affected"
,
null:
false
...
@@ -1863,6 +1877,7 @@ ActiveRecord::Schema.define(version: 20170627211700) do
...
@@ -1863,6 +1877,7 @@ ActiveRecord::Schema.define(version: 20170627211700) do
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
on_delete: :cascade
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_repository_deleted_events"
,
column:
"repository_deleted_event_id"
,
name:
"fk_c4b1c1f66e"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_repository_deleted_events"
,
column:
"repository_deleted_event_id"
,
name:
"fk_c4b1c1f66e"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_repository_updated_events"
,
column:
"repository_updated_event_id"
,
on_delete: :cascade
add_foreign_key
"geo_event_log"
,
"geo_repository_updated_events"
,
column:
"repository_updated_event_id"
,
on_delete: :cascade
add_foreign_key
"geo_repository_renamed_events"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"geo_repository_updated_events"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"geo_repository_updated_events"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"index_statuses"
,
"projects"
,
name:
"fk_74b2492545"
,
on_delete: :cascade
add_foreign_key
"index_statuses"
,
"projects"
,
name:
"fk_74b2492545"
,
on_delete: :cascade
add_foreign_key
"issue_assignees"
,
"issues"
,
name:
"fk_b7d881734a"
,
on_delete: :cascade
add_foreign_key
"issue_assignees"
,
"issues"
,
name:
"fk_b7d881734a"
,
on_delete: :cascade
...
...
spec/models/geo/event_log_spec.rb
View file @
6e5fa040
...
@@ -3,5 +3,6 @@ require 'spec_helper'
...
@@ -3,5 +3,6 @@ require 'spec_helper'
RSpec
.
describe
Geo
::
EventLog
,
type: :model
do
RSpec
.
describe
Geo
::
EventLog
,
type: :model
do
describe
'relationships'
do
describe
'relationships'
do
it
{
is_expected
.
to
belong_to
(
:repository_updated_event
).
class_name
(
'Geo::RepositoryUpdatedEvent'
).
with_foreign_key
(
'repository_updated_event_id'
)
}
it
{
is_expected
.
to
belong_to
(
:repository_updated_event
).
class_name
(
'Geo::RepositoryUpdatedEvent'
).
with_foreign_key
(
'repository_updated_event_id'
)
}
it
{
is_expected
.
to
belong_to
(
:repository_renamed_event
).
class_name
(
'Geo::RepositoryRenamedEvent'
).
with_foreign_key
(
'repository_renamed_event_id'
)
}
end
end
end
end
spec/models/geo/repository_renamed_event_spec.rb
0 → 100644
View file @
6e5fa040
require
'spec_helper'
RSpec
.
describe
Geo
::
RepositoryRenamedEvent
,
type: :model
do
describe
'relationships'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
end
describe
'validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:repository_storage_name
)
}
it
{
is_expected
.
to
validate_presence_of
(
:repository_storage_path
)
}
it
{
is_expected
.
to
validate_presence_of
(
:old_path_with_namespace
)
}
it
{
is_expected
.
to
validate_presence_of
(
:new_path_with_namespace
)
}
it
{
is_expected
.
to
validate_presence_of
(
:old_wiki_path_with_namespace
)
}
it
{
is_expected
.
to
validate_presence_of
(
:new_wiki_path_with_namespace
)
}
it
{
is_expected
.
to
validate_presence_of
(
:old_project_name
)
}
it
{
is_expected
.
to
validate_presence_of
(
:new_project_name
)
}
end
end
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