Sha256: 67d6b3f059942407c297e4a918425aeed523fe0134979a57144bb1e6bc8ddcf7

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

class ActsAsFavoritorMigration < ActiveRecord::Migration<% if Rails::VERSION::MAJOR >= 5 %>[Rails::VERSION::STRING[0..2].to_f]<% end %>
    def self.up
        create_table :favorites, force: true do |t|
            t.references :favoritable, polymorphic: true, null: false
            t.references :favoritor, polymorphic: true, null: false
            t.string :lists, default: [:favorites].to_yaml, null: false
            t.boolean :blocked, default: false, null: false
            t.timestamps
        end

        add_index :favorites, ['favoritor_id', 'favoritor_type'], name: 'fk_favorites'
        add_index :favorites, ['favoritable_id', 'favoritable_type'], name: 'fk_favoritables'
    end

    def self.down
    drop_table :favorites
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_favoritor-1.0.1 lib/generators/templates/migration.rb.erb