Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20150504010150_migrate_url_to_path.rb « migrate « ci « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 31d8c5402fddfbd50525d67768b7d303cbb32da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
class MigrateUrlToPath < ActiveRecord::Migration
  def up
    select_all("SELECT id, gitlab_url FROM projects").each do |project|
      path = project['gitlab_url'].sub(/.*\/(.*\/.*)$/, '\1')
      execute("UPDATE projects SET gitlab_url = '#{path}' WHERE id = '#{project['id']}'")
    end
  end

  def down
  end
end