Commit c98ed42d authored by Bob Van Landuyt's avatar Bob Van Landuyt Committed by Bob Van Landuyt

Revert renames from a migration

parent 152cba56
...@@ -104,5 +104,6 @@ class RenameAllReservedPathsAgain < ActiveRecord::Migration ...@@ -104,5 +104,6 @@ class RenameAllReservedPathsAgain < ActiveRecord::Migration
end end
def down def down
revert_renames
end end
end end
...@@ -29,6 +29,11 @@ module Gitlab ...@@ -29,6 +29,11 @@ module Gitlab
paths = Array(paths) paths = Array(paths)
RenameNamespaces.new(paths, self).rename_namespaces(type: :top_level) RenameNamespaces.new(paths, self).rename_namespaces(type: :top_level)
end end
def revert_renames
RenameProjects.new([], self).revert_renames
RenameNamespaces.new([], self).revert_renames
end
end end
end end
end end
......
...@@ -51,4 +51,26 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :truncate do ...@@ -51,4 +51,26 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :truncate do
subject.rename_root_paths('the-path') subject.rename_root_paths('the-path')
end end
end end
describe '#revert_renames' do
it 'renames namespaces' do
rename_namespaces = double
expect(described_class::RenameNamespaces).
to receive(:new).with([], subject).
and_return(rename_namespaces)
expect(rename_namespaces).to receive(:revert_renames)
subject.revert_renames
end
it 'renames projects' do
rename_projects = double
expect(described_class::RenameProjects).
to receive(:new).with([], subject).
and_return(rename_projects)
expect(rename_projects).to receive(:revert_renames)
subject.revert_renames
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