summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-05-04 18:11:20 +0300
committerValery Sizov <vsv2711@gmail.com>2015-05-04 18:11:20 +0300
commitce534e9395b9c6eaaef7400547a5adc613f046a7 (patch)
treec869863d978a26d4864436d91d129b635c18d564 /db
parent5b7589664297fd066324acfb9b6eafe2ad1d432c (diff)
downloadgitlab-ci-ce534e9395b9c6eaaef7400547a5adc613f046a7.tar.gz
Refactoring. Clean up advanced settings. Migrate from gotlab_url to path
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150504010150_migrate_url_to_path.rb11
-rw-r--r--db/migrate/20150504010250_rename_gitlab_url_to_path.rb5
-rw-r--r--db/schema.rb4
3 files changed, 18 insertions, 2 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
diff --git a/db/schema.rb b/db/schema.rb
index f16ae4c..596e11f 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20150417000045) do
+ActiveRecord::Schema.define(version: 20150504010250) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -87,7 +87,7 @@ ActiveRecord::Schema.define(version: 20150417000045) do
t.datetime "updated_at"
t.string "token"
t.string "default_ref"
- t.string "gitlab_url"
+ t.string "path"
t.boolean "always_build", default: false, null: false
t.integer "polling_interval"
t.boolean "public", default: false, null: false