summaryrefslogtreecommitdiff
path: root/db/migrate/20191127151619_create_gitlab_subscription_histories.rb
blob: 718f2c1b313ed0d396ba3fd413dea872d8efd7d1 (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
# frozen_string_literal: true

class CreateGitlabSubscriptionHistories < ActiveRecord::Migration[5.2]
  DOWNTIME = false

  def up
    create_table :gitlab_subscription_histories do |t|
      t.datetime_with_timezone :gitlab_subscription_created_at
      t.datetime_with_timezone :gitlab_subscription_updated_at
      t.date :start_date
      t.date :end_date
      t.date :trial_ends_on
      t.integer :namespace_id, null: true
      t.integer :hosted_plan_id, null: true
      t.integer :max_seats_used
      t.integer :seats
      t.boolean :trial
      t.integer :change_type, limit: 2
      t.bigint :gitlab_subscription_id, null: false
      t.datetime_with_timezone :created_at
    end
    add_index :gitlab_subscription_histories, :gitlab_subscription_id
  end

  def down
    drop_table :gitlab_subscription_histories
  end
end