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

class CreateProjectExportJobs < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  # rubocop:disable Migration/PreventStrings
  def change
    create_table :project_export_jobs do |t|
      t.references :project, index: false, null: false, foreign_key: { on_delete: :cascade }
      t.timestamps_with_timezone null: false
      t.integer :status, limit: 2, null: false, default: 0
      t.string :jid, limit: 100, null: false, unique: true

      t.index [:project_id, :jid]
      t.index [:jid], unique: true
      t.index [:status]
      t.index [:project_id, :status]
    end
  end
  # rubocop:enable Migration/PreventStrings
end