diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-26 04:42:46 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-26 04:42:46 +0300 |
commit | 046b28312704f3131e72dcd2dbdacc5264d4aa62 (patch) | |
tree | a8c2b14a6e1db3b662fee2c79af70d9fcb643c2e /db/ci/migrate/20141104130024_migrate_jobs.rb | |
parent | e449426a4e7d15cdd582d4f136add52cbfb5e04e (diff) |
Groundwork for merging CI into CE
Diffstat (limited to 'db/ci/migrate/20141104130024_migrate_jobs.rb')
-rw-r--r-- | db/ci/migrate/20141104130024_migrate_jobs.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/db/ci/migrate/20141104130024_migrate_jobs.rb b/db/ci/migrate/20141104130024_migrate_jobs.rb new file mode 100644 index 00000000000..1d80fb836b6 --- /dev/null +++ b/db/ci/migrate/20141104130024_migrate_jobs.rb @@ -0,0 +1,12 @@ +class MigrateJobs < ActiveRecord::Migration + def up + Project.find_each(batch_size: 100) do |project| + job = project.jobs.create(commands: project.scripts) + project.builds.order('id DESC').limit(10).update_all(job_id: job.id) + end + end + + def down + Job.destroy_all + end +end |