2016-10-31 11:00:53 +00:00
|
|
|
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
|
|
|
|
# for more information on how to write migrations for GitLab.
|
|
|
|
|
|
|
|
class FillRoutesTable < ActiveRecord::Migration
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = true
|
|
|
|
DOWNTIME_REASON = 'No new namespaces should be created during data copy'
|
|
|
|
|
|
|
|
def up
|
|
|
|
execute <<-EOF
|
|
|
|
INSERT INTO routes
|
|
|
|
(source_id, source_type, path)
|
|
|
|
(SELECT id, 'Namespace', path FROM namespaces)
|
|
|
|
EOF
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
2016-12-15 13:32:06 +00:00
|
|
|
execute("DELETE FROM routes WHERE source_type = 'Namespace'")
|
2016-10-31 11:00:53 +00:00
|
|
|
end
|
|
|
|
end
|