From b1ea0cc41bbf89c946e8811fb7f3082f58ea1586 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 3 Jun 2019 10:26:19 +0000 Subject: [PATCH] Merge branch 'sh-fix-issue-58714' into 'master' Fix migration failure when groups are missing route Closes #58714 See merge request gitlab-org/gitlab-ce!29022 (cherry picked from commit 0488c26ec6d10b943999b7fb61ca7209ab2c275e) a52cbf6b Fix migration failure when groups are missing route --- changelogs/unreleased/sh-fix-issue-58714.yml | 5 +++++ db/migrate/20180702134423_generate_missing_routes.rb | 1 + spec/migrations/generate_missing_routes_spec.rb | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/sh-fix-issue-58714.yml diff --git a/changelogs/unreleased/sh-fix-issue-58714.yml b/changelogs/unreleased/sh-fix-issue-58714.yml new file mode 100644 index 00000000000..597a011b6f3 --- /dev/null +++ b/changelogs/unreleased/sh-fix-issue-58714.yml @@ -0,0 +1,5 @@ +--- +title: Fix migration failure when groups are missing route +merge_request: 29022 +author: +type: fixed diff --git a/db/migrate/20180702134423_generate_missing_routes.rb b/db/migrate/20180702134423_generate_missing_routes.rb index a440bc3179c..dd1106c9e6a 100644 --- a/db/migrate/20180702134423_generate_missing_routes.rb +++ b/db/migrate/20180702134423_generate_missing_routes.rb @@ -98,6 +98,7 @@ class GenerateMissingRoutes < ActiveRecord::Migration[4.2] class Namespace < ActiveRecord::Base self.table_name = 'namespaces' + self.inheritance_column = :_type_disabled include EachBatch include GenerateMissingRoutes::Routable diff --git a/spec/migrations/generate_missing_routes_spec.rb b/spec/migrations/generate_missing_routes_spec.rb index 32515d353b0..30ad135d4df 100644 --- a/spec/migrations/generate_missing_routes_spec.rb +++ b/spec/migrations/generate_missing_routes_spec.rb @@ -8,7 +8,7 @@ describe GenerateMissingRoutes, :migration do let(:routes) { table(:routes) } it 'creates routes for projects without a route' do - namespace = namespaces.create!(name: 'GitLab', path: 'gitlab') + namespace = namespaces.create!(name: 'GitLab', path: 'gitlab', type: 'Group') routes.create!( path: 'gitlab', -- GitLab