summaryrefslogtreecommitdiff
path: root/db/post_migrate/20201019094741_rename_sitemap_root_namespaces.rb
blob: 20812a53bfb61f2ba143cd990b4164363758262e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

class RenameSitemapRootNamespaces < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers
  include Gitlab::Database::RenameReservedPathsMigration::V1

  DOWNTIME = false

  disable_ddl_transaction!

  # We're taking over the /sitemap.xml and /sitemap.xml.gz namespaces
  # since they're necessary for the default behavior of Sitemaps
  def up
    disable_statement_timeout do
      rename_root_paths(['sitemap.xml', 'sitemap.xml.gz'])
    end
  end

  def down
    disable_statement_timeout do
      revert_renames
    end
  end
end