Sha256: 18c895fb25e7a493f64f66c37a3b80b59bf21bfd708d353c1726ed14839d37fb

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

class ActsAsFavoritorMigration < ActiveRecord::Migration<% if Rails::VERSION::MAJOR >= 5 %>[<%= @rails_version %>]<% 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 :scope, default: ActsAsFavoritor.default_scope, null: false, index: true
            t.boolean :blocked, default: false, null: false, index: true
            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

2 entries across 2 versions & 1 rubygems

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