diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-04 18:07:54 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-04 18:07:54 +0200 |
commit | 11218e13414814e00cbeffe05077718f856af897 (patch) | |
tree | ce24e898f6a962f2a0364e45e15ef55b52673180 /db | |
parent | 0a002b8d897047c7a9951c015af689896194c687 (diff) | |
download | gitlab-ci-11218e13414814e00cbeffe05077718f856af897.tar.gz |
Add naming to jobs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20141104130024_migrate_jobs.rb | 8 | ||||
-rw-r--r-- | db/migrate/20141104153744_add_name_to_job.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 3 |
3 files changed, 13 insertions, 3 deletions
diff --git a/db/migrate/20141104130024_migrate_jobs.rb b/db/migrate/20141104130024_migrate_jobs.rb index c7b20fa..1d80fb8 100644 --- a/db/migrate/20141104130024_migrate_jobs.rb +++ b/db/migrate/20141104130024_migrate_jobs.rb @@ -1,8 +1,12 @@ class MigrateJobs < ActiveRecord::Migration - def change + def up Project.find_each(batch_size: 100) do |project| job = project.jobs.create(commands: project.scripts) - project.builds.update_all(job_id: job.id) + project.builds.order('id DESC').limit(10).update_all(job_id: job.id) end end + + def down + Job.destroy_all + end end diff --git a/db/migrate/20141104153744_add_name_to_job.rb b/db/migrate/20141104153744_add_name_to_job.rb new file mode 100644 index 0000000..ef4dd17 --- /dev/null +++ b/db/migrate/20141104153744_add_name_to_job.rb @@ -0,0 +1,5 @@ +class AddNameToJob < ActiveRecord::Migration + def change + add_column :jobs, :name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 973cbae..73830b6 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: 20141104130024) do +ActiveRecord::Schema.define(version: 20141104153744) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -63,6 +63,7 @@ ActiveRecord::Schema.define(version: 20141104130024) do t.boolean "active", default: true, null: false t.datetime "created_at" t.datetime "updated_at" + t.string "name" end add_index "jobs", ["project_id"], name: "index_jobs_on_project_id", using: :btree |