Sha256: c6584e2872c1941bc4a6b702f622dad4937bdf58be40957663939bc14b7bc411

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

class CreateTalkieComments < ActiveRecord::Migration[5.0]
  def self.up
    create_table :talkie_comments do |t|
      t.string   :creator_type
      t.integer  :creator_id
      t.integer  :commentable_id
      t.string   :commentable_type
      t.text     :body, null: false
      t.integer  :parent_id
      t.integer  :lft
      t.integer  :rgt
      t.integer  :children_count, default: 0

      t.timestamps null: false
    end

    add_index :talkie_comments, :commentable_id
    add_index :talkie_comments, :commentable_type
    add_index :talkie_comments, [:creator_id, :creator_type],
              name: 'index_talkie_comments_on_creator_id_and_creator_type'
  end

  def self.down
    drop_table :talkie_comments
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
talkie-0.2.0 lib/generators/talkie/templates/create_talkie_comments.rb
talkie-0.1.1 lib/generators/talkie/templates/create_talkie_comments.rb