summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-03 19:19:08 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-03 19:45:27 +0300
commit0cb18461890ecf514cab9ea4e7b236eeae3bef0d (patch)
tree2c50560cf1c644afbc725b5cb94821557f6c84e4 /db
parent0aded8fe871214c92dd43978e8573fbd395f4214 (diff)
downloadgitlab-ci-0cb18461890ecf514cab9ea4e7b236eeae3bef0d.tar.gz
migrate job names
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150528011012_remove_unused_fields.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/db/migrate/20150528011012_remove_unused_fields.rb b/db/migrate/20150528011012_remove_unused_fields.rb
index c8f5e89..2895169 100644
--- a/db/migrate/20150528011012_remove_unused_fields.rb
+++ b/db/migrate/20150528011012_remove_unused_fields.rb
@@ -1,5 +1,13 @@
class RemoveUnusedFields < ActiveRecord::Migration
- def change
+ def up
+ select_all("SELECT id, name FROM jobs").each do |job|
+ execute("UPDATE builds SET name = '#{quote_string(job["name"])}' WHERE job_id = #{job["id"]}")
+ end
+
remove_column :builds, :job_id, :integer
end
+
+ def down
+ add_column :builds, :job_id, :integer
+ end
end