summaryrefslogtreecommitdiff
path: root/db/migrate/20200904131544_create_ci_build_pending_states.rb
blob: 2c21ce3ce3270d7145f4946ff91bbd3c835f82ec (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
# frozen_string_literal: true

class CreateCiBuildPendingStates < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    with_lock_retries do
      create_table :ci_build_pending_states do |t|
        t.timestamps_with_timezone
        t.references :build, index: { unique: true }, null: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }, type: :bigint
        t.integer :state
        t.integer :failure_reason
        t.binary :trace_checksum
      end
    end
  end

  def down
    with_lock_retries do
      drop_table :ci_build_pending_states
    end
  end
end