summaryrefslogtreecommitdiff
path: root/db/migrate/20170425112128_create_pipeline_schedules_table.rb
blob: 3612a796ae869e8c8b97008199f7320a461fd16a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class CreatePipelineSchedulesTable < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    create_table :ci_pipeline_schedules do |t|
      t.string :description
      t.string :ref
      t.string :cron
      t.string :cron_timezone
      t.datetime :next_run_at
      t.integer :project_id
      t.integer :owner_id
      t.boolean :active, default: true
      t.datetime :deleted_at

      t.timestamps
    end

    add_index(:ci_pipeline_schedules, :project_id)
    add_index(:ci_pipeline_schedules, [:next_run_at, :active])
  end

  def down
    drop_table :ci_pipeline_schedules
  end
end