summaryrefslogtreecommitdiff
path: root/db/migrate/20220619182308_create_project_relation_exports.rb
blob: 7b92ca5110fbc7a1ca38f795fa842a6d009873bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class CreateProjectRelationExports < Gitlab::Database::Migration[2.0]
  enable_lock_retries!

  UNIQUE_INDEX_NAME = 'index_project_export_job_relation'

  def change
    create_table :project_relation_exports do |t|
      t.references :project_export_job, null: false, foreign_key: { on_delete: :cascade }
      t.timestamps_with_timezone null: false
      t.integer :status, limit: 2, null: false, default: 0
      t.text :relation, null: false, limit: 255
      t.text :jid, limit: 255
      t.text :export_error, limit: 300

      t.index [:project_export_job_id, :relation], unique: true, name: UNIQUE_INDEX_NAME
    end
  end
end