Commit c1183dc1 authored by Stan Hu's avatar Stan Hu

Add repository storage name to deleted events table

parent c9aa2663
...@@ -14,11 +14,13 @@ module EE ...@@ -14,11 +14,13 @@ module EE
Geo::EventLog.transaction do Geo::EventLog.transaction do
event_log = Geo::EventLog.new event_log = Geo::EventLog.new
deleted_event = Geo::RepositoryDeletedEvent.new(project: project, deleted_event = Geo::RepositoryDeletedEvent.new(
repository_storage_path: project.repository_storage_path, project: project,
deleted_path: repo_path, repository_storage_name: project.repository.storage,
deleted_wiki_path: wiki_path, repository_storage_path: project.repository_storage_path,
deleted_project_name: project.name) deleted_path: repo_path,
deleted_wiki_path: wiki_path,
deleted_project_name: project.name)
event_log.repository_deleted_event = deleted_event event_log.repository_deleted_event = deleted_event
event_log.save event_log.save
end end
......
...@@ -7,6 +7,7 @@ class CreateGeoRepositoryDeletedEvents < ActiveRecord::Migration ...@@ -7,6 +7,7 @@ class CreateGeoRepositoryDeletedEvents < ActiveRecord::Migration
create_table :geo_repository_deleted_events, id: :bigserial do |t| create_table :geo_repository_deleted_events, id: :bigserial do |t|
# If a project is deleted, we need to retain this entry # If a project is deleted, we need to retain this entry
t.references :project, index: true, foreign_key: false, null: false t.references :project, index: true, foreign_key: false, null: false
t.text :repository_storage_name, null: false
t.text :repository_storage_path, null: false t.text :repository_storage_path, null: false
t.text :deleted_path, null: false t.text :deleted_path, null: false
t.text :deleted_wiki_path t.text :deleted_wiki_path
......
...@@ -609,6 +609,7 @@ ActiveRecord::Schema.define(version: 20170614115405) do ...@@ -609,6 +609,7 @@ ActiveRecord::Schema.define(version: 20170614115405) do
create_table "geo_repository_deleted_events", id: :bigserial, force: :cascade do |t| create_table "geo_repository_deleted_events", id: :bigserial, force: :cascade do |t|
t.integer "project_id", null: false t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "repository_storage_path", null: false t.text "repository_storage_path", null: false
t.text "deleted_path", null: false t.text "deleted_path", null: false
t.text "deleted_wiki_path" t.text "deleted_wiki_path"
......
...@@ -8,6 +8,7 @@ describe Projects::DestroyService, services: true do ...@@ -8,6 +8,7 @@ describe Projects::DestroyService, services: true do
let!(:project_name) { project.name } let!(:project_name) { project.name }
let!(:project_path) { project.path_with_namespace } let!(:project_path) { project.path_with_namespace }
let!(:wiki_path) { project.path_with_namespace + '.wiki' } let!(:wiki_path) { project.path_with_namespace + '.wiki' }
let!(:storage_name) { project.repository_storage }
let!(:storage_path) { project.repository_storage_path } let!(:storage_path) { project.repository_storage_path }
let!(:geo_node) { create(:geo_node, :primary, :current) } let!(:geo_node) { create(:geo_node, :primary, :current) }
...@@ -29,6 +30,7 @@ describe Projects::DestroyService, services: true do ...@@ -29,6 +30,7 @@ describe Projects::DestroyService, services: true do
expect(event.deleted_path).to eq(project_path) expect(event.deleted_path).to eq(project_path)
expect(event.deleted_wiki_path).to eq(wiki_path) expect(event.deleted_wiki_path).to eq(wiki_path)
expect(event.deleted_project_name).to eq(project_name) expect(event.deleted_project_name).to eq(project_name)
expect(event.repository_storage_name).to eq(storage_name)
expect(event.repository_storage_path).to eq(storage_path) expect(event.repository_storage_path).to eq(storage_path)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment