summaryrefslogtreecommitdiff
path: root/db/migrate/20230210152109_add_bulk_import_export_batches.rb
blob: 380f8a43aaebf3cd86a5fc36bb5a9d9c7e3b0ee3 (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 AddBulkImportExportBatches < Gitlab::Database::Migration[2.1]
  def up
    create_table :bulk_import_export_batches do |t|
      t.references :export, index: true, null: false, foreign_key: {
        to_table: :bulk_import_exports, on_delete: :cascade
      }
      t.timestamps_with_timezone null: false
      t.integer :status, limit: 2, null: false, default: 0
      t.integer :batch_number, null: false, default: 0
      t.integer :objects_count, null: false, default: 0
      t.text :error, limit: 255
      t.index [:export_id, :batch_number], unique: true, name: 'i_bulk_import_export_batches_id_batch_number'
    end
  end

  def down
    drop_table :bulk_import_export_batches
  end
end