diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-29 11:50:22 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-29 11:50:22 +0000 |
commit | 971604de4cfa324d91c41650fabc129420c8d1cc (patch) | |
tree | 86b807bd9672d3603745dceca6fed2abd16cd307 /db | |
parent | da6a3fb0c24e2af59d6fbd3421446b8f7666cdf6 (diff) | |
parent | 7c53fcf11fff8a05442ae813c9da76a9ed710abd (diff) | |
download | gitlab-ce-971604de4cfa324d91c41650fabc129420c8d1cc.tar.gz |
Merge branch 'bvl-rename-all-reserved-paths' into 'master'
Rename all forbidden paths again
Closes #32625
See merge request !11713
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb b/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb new file mode 100644 index 00000000000..9441b236c8d --- /dev/null +++ b/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb @@ -0,0 +1,113 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RenameAllReservedPathsAgain < ActiveRecord::Migration + include Gitlab::Database::RenameReservedPathsMigration::V1 + + DOWNTIME = false + + disable_ddl_transaction! + + TOP_LEVEL_ROUTES = %w[ + - + .well-known + abuse_reports + admin + all + api + assets + autocomplete + ci + dashboard + explore + files + groups + health_check + help + hooks + import + invites + issues + jwt + koding + member + merge_requests + new + notes + notification_settings + oauth + profile + projects + public + repository + robots.txt + s + search + sent_notifications + services + snippets + teams + u + unicorn_test + unsubscribes + uploads + users + ].freeze + + PROJECT_WILDCARD_ROUTES = %w[ + badges + blame + blob + builds + commits + create + create_dir + edit + environments/folders + files + find_file + gitlab-lfs/objects + info/lfs/objects + new + preview + raw + refs + tree + update + wikis + ].freeze + + GROUP_ROUTES = %w[ + activity + analytics + audit_events + avatar + edit + group_members + hooks + issues + labels + ldap + ldap_group_links + merge_requests + milestones + notification_setting + pipeline_quota + projects + subgroups + ].freeze + + def up + disable_statement_timeout + + TOP_LEVEL_ROUTES.each { |route| rename_root_paths(route) } + PROJECT_WILDCARD_ROUTES.each { |route| rename_wildcard_paths(route) } + GROUP_ROUTES.each { |route| rename_child_paths(route) } + end + + def down + disable_statement_timeout + + revert_renames + end +end |