diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-05-04 18:11:20 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-05-04 18:11:20 +0300 |
commit | ce534e9395b9c6eaaef7400547a5adc613f046a7 (patch) | |
tree | c869863d978a26d4864436d91d129b635c18d564 /db/migrate | |
parent | 5b7589664297fd066324acfb9b6eafe2ad1d432c (diff) | |
download | gitlab-ci-ce534e9395b9c6eaaef7400547a5adc613f046a7.tar.gz |
Refactoring. Clean up advanced settings. Migrate from gotlab_url to path
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20150504010150_migrate_url_to_path.rb | 11 | ||||
-rw-r--r-- | db/migrate/20150504010250_rename_gitlab_url_to_path.rb | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20150504010150_migrate_url_to_path.rb b/db/migrate/20150504010150_migrate_url_to_path.rb new file mode 100644 index 0000000..31d8c54 --- /dev/null +++ b/db/migrate/20150504010150_migrate_url_to_path.rb @@ -0,0 +1,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 diff --git a/db/migrate/20150504010250_rename_gitlab_url_to_path.rb b/db/migrate/20150504010250_rename_gitlab_url_to_path.rb new file mode 100644 index 0000000..6040c32 --- /dev/null +++ b/db/migrate/20150504010250_rename_gitlab_url_to_path.rb @@ -0,0 +1,5 @@ +class RenameGitlabUrlToPath < ActiveRecord::Migration + def change + rename_column :projects, :gitlab_url, :path + end +end |