summaryrefslogtreecommitdiff
path: root/db/migrate/20200326114443_create_jira_imports_table.rb
blob: d53ccb166b0dd8598684ce2789a2789a1314807c (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
29
30
31
# frozen_string_literal: true

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

  DOWNTIME = false

  disable_ddl_transaction!

  # rubocop:disable Migration/PreventStrings
  def change
    create_table :jira_imports do |t|
      t.integer :project_id, null: false, limit: 8
      t.integer :user_id, limit: 8
      t.integer :label_id, limit: 8
      t.timestamps_with_timezone
      t.datetime_with_timezone :finished_at
      t.integer :jira_project_xid, null: false, limit: 8
      t.integer :total_issue_count, null: false, default: 0, limit: 4
      t.integer :imported_issues_count, null: false, default: 0, limit: 4
      t.integer :failed_to_import_count, null: false, default: 0, limit: 4
      t.integer :status, limit: 2, null: false, default: 0
      t.string :jid, limit: 255
      t.string :jira_project_key, null: false, limit: 255
      t.string :jira_project_name, null: false, limit: 255
    end

    add_index :jira_imports, [:project_id, :jira_project_key], name: 'index_jira_imports_on_project_id_and_jira_project_key'
  end
  # rubocop:enable Migration/PreventStrings
end