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

20141104130024_migrate_jobs.rb « migrate « ci « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1d80fb836b6d6a465f46b4456e89307f3d020781 (plain)
1
2
3
4
5
6
7
8
9
10
11
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