Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20200420104303_add_group_import_states_table.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 10b8cd4aa4987e2a8f644751d69130d200a4909f (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
# frozen_string_literal: true

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

  DOWNTIME = false

  # rubocop:disable Migration/AddLimitToTextColumns
  def up
    with_lock_retries do
      create_table :group_import_states, id: false do |t|
        t.references :group, primary_key: true, foreign_key: { to_table: :namespaces, on_delete: :cascade }
        t.timestamps_with_timezone null: false
        t.integer :status, limit: 2, null: false, default: 0
        t.text :jid, null: false, unique: true
        t.text :last_error
      end
    end
  end
  # rubocop:enable Migration/AddLimitToTextColumns

  def down
    # rubocop:disable Migration/DropTable
    drop_table :group_import_states
    # rubocop:enable Migration/DropTable
  end
end