Class: CreateShares

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/how_are_we_doing/install/templates/db/migrate/create_shares.rb

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/how_are_we_doing/install/templates/db/migrate/create_shares.rb', line 17

def self.down
  drop_table :shares
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/how_are_we_doing/install/templates/db/migrate/create_shares.rb', line 2

def self.up
  create_table :shares do |t|
    t.references :shareable, :polymorphic => true
    t.references :user
    t.string :service_ident, :limit => 48
    t.string :url_hash
    t.timestamps
  end
  
  add_index :shares, [:shareable_id, :shareable_type]
  add_index :shares, :user_id
  add_index :shares, :service_ident
  add_index :shares, :url_hash
end