summaryrefslogtreecommitdiff
path: root/db/migrate/20200803125340_create_raw_usage_data.rb
blob: f1c23a7b0f565a5470b2d753a063a1019b3681b4 (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
# frozen_string_literal: true

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

  DOWNTIME = false

  def up
    unless table_exists?(:raw_usage_data)
      create_table :raw_usage_data do |t|
        t.timestamps_with_timezone
        t.datetime_with_timezone :recorded_at, null: false
        t.datetime_with_timezone :sent_at
        t.jsonb :payload, null: false

        t.index [:recorded_at], unique: true
      end
    end
  end

  def down
    drop_table :raw_usage_data
  end
end