Sha256: 0932d351c826185d24c0424d6c5ef2ac503c6f14e836ee78e6be59a92bb07e52

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

class CreateMakeWatchableTables < ActiveRecord::Migration
   def self.up
     create_table :watchings do |t|
       t.string :watchable_type
       t.integer :watchable_id
       t.string :watcher_type
       t.integer :watcher_id

       t.timestamps
    end

    add_index :watchings, [:watchable_type, :watchable_id]
    add_index :watchings, [:watcher_type, :watcher_id, :watchable_type, :watchable_id], :name => "access_watchings"
  end

  def self.down
    remove_index :watchings, :column => [:watchable_type, :watchable_id]
    remove_index :watchings, :name => "access_watchings"
    
    drop_table :watchings
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
make_watchable-0.0.3 lib/generators/make_watchable/templates/migration.rb
make_watchable-0.0.2 lib/generators/make_watchable/templates/migration.rb