summaryrefslogtreecommitdiff
path: root/db/migrate/20210625094554_create_error_tracking_error_events.rb
blob: c1ed6d6ce6e558a38fd4b811c61bded56ea440a9 (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
# frozen_string_literal: true

class CreateErrorTrackingErrorEvents < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  def up
    create_table_with_constraints :error_tracking_error_events do |t|
      t.references :error,
        index: true,
        null: false,
        foreign_key: { on_delete: :cascade, to_table: :error_tracking_errors }

      t.text :description, null: false
      t.text :environment
      t.text :level
      t.datetime_with_timezone :occurred_at, null: false
      t.jsonb :payload, null: false, default: {}

      t.text_limit :description, 255
      t.text_limit :environment, 255
      t.text_limit :level, 255

      t.timestamps_with_timezone
    end
  end

  def down
    drop_table :error_tracking_error_events
  end
end