Sha256: 40b6317cd3e671c36dec05cfff64fa5cc13edaec4c82c8b8b358e4c0475f72d0

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

class CommentableOnMigration < ActiveRecord::Migration<%= migration_version %>
  def self.up
    create_table :comments do |t|
      t.references :commentable, polymorphic: true
      t.references :commenter, polymorphic: true
      t.text :body
      t.string :thread

      t.timestamps
    end

    add_index :comments, :thread
    add_index :comments, [:commenter_id, :commenter_type]
    add_index :comments, [:commentable_id, :commentable_type]
  end

  def self.down
    drop_table :comments
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commentable_on-1.1.0 lib/generators/commentable_on/migration/templates/active_record/migration.erb
commentable_on-1.0.0 lib/generators/commentable_on/migration/templates/active_record/migration.erb