Sha256: b18f011351ecd23a293e79007dd6bac34e717d6180fb6ccdfacb23b67cbb77f8

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

class ActsAsSaveableMigration < ActiveRecord::Migration
  def self.up
    create_table :saves do |t|

      t.references :saveable, :polymorphic => true
      t.references :saver, :polymorphic => true

      t.boolean :save_flag
      t.string :save_scope
      t.integer :save_weight

      t.timestamps
    end

    if ActiveRecord::VERSION::MAJOR < 4
      add_index :saves, [:saveable_id, :saveable_type]
      add_index :saves, [:saver_id, :saver_type]
    end

    add_index :saves, [:saver_id, :saver_type, :save_scope]
    add_index :saves, [:saveable_id, :saveable_type, :save_scope]
  end

  def self.down
    drop_table :saves
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_saveable-0.10.1 lib/generators/acts_as_saveable/migration/templates/active_record/migration.rb