Sha256: 3c3ae324847adbeaf9c29ec71bc68499ce59e55c504c85c76d918b0f255c69ff

Contents?: true

Size: 831 Bytes

Versions: 6

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

class ActsAsFavoritorMigration < ActiveRecord::Migration<%= migration_version %>
  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.configuration.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

6 entries across 6 versions & 1 rubygems

Version Path
acts_as_favoritor-5.0.1 lib/generators/templates/migration.rb.erb
acts_as_favoritor-5.0.0 lib/generators/templates/migration.rb.erb
acts_as_favoritor-4.0.3 lib/generators/templates/migration.rb.erb
acts_as_favoritor-4.0.2 lib/generators/templates/migration.rb.erb
acts_as_favoritor-4.0.1 lib/generators/templates/migration.rb.erb
acts_as_favoritor-4.0.0 lib/generators/templates/migration.rb.erb