Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/ci/migrate/20141104130024_migrate_jobs.rb')
-rw-r--r--db/ci/migrate/20141104130024_migrate_jobs.rb12
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