20180125214301_create_user_callouts.rb 549 Bytes
Newer Older
Matija Čupić's avatar
Matija Čupić committed
1 2 3
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

4
class CreateUserCallouts < ActiveRecord::Migration[4.2]
Matija Čupić's avatar
Matija Čupić committed
5 6 7 8
  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false

  def change
9
    create_table :user_callouts do |t|
10
      t.integer :feature_name, null: false
Matija Čupić's avatar
Matija Čupić committed
11 12 13
      t.references :user, index: true, foreign_key: { on_delete: :cascade }, null: false
    end

14
    add_index :user_callouts, [:user_id, :feature_name], unique: true
Matija Čupić's avatar
Matija Čupić committed
15 16
  end
end