Class: CreateOptOuts

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/opt_outs_migration.rb

Instance Method Summary collapse

Instance Method Details

#downObject



12
13
14
# File 'lib/generators/templates/opt_outs_migration.rb', line 12

def down
  drop_table :opt_outs
end

#upObject



2
3
4
5
6
7
8
9
10
# File 'lib/generators/templates/opt_outs_migration.rb', line 2

def up
  create_table :opt_outs do |t|
    t.integer :user_id
    t.string :feature
    t.timestamps
  end

  add_index :opt_outs, [:user_id, :feature], unique: true
end