Sha256: 556b168a8c2d3dd05fd771fbdc4e639d7b03e076308a07b3af117cdf0072b9bf

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

class InstallCommontator < ActiveRecord::Migration[5.0]
  def change
    create_table :commontator_comments do |t|
      t.string   :creator_type
      t.integer  :creator_id
      t.string   :editor_type
      t.integer  :editor_id
      t.integer  :thread_id, null: false
      t.text     :body, null: false
      t.datetime :deleted_at

      t.integer :cached_votes_up, default: 0
      t.integer :cached_votes_down, default: 0

      t.timestamps null: false
    end

    add_index :commontator_comments, [:creator_id, :creator_type, :thread_id],
              name: 'index_commontator_comments_on_c_id_and_c_type_and_t_id'
    add_index :commontator_comments, [:thread_id, :created_at]

    add_index  :commontator_comments, :cached_votes_up
    add_index  :commontator_comments, :cached_votes_down

    create_table :commontator_subscriptions do |t|
      t.string   :subscriber_type, null: false
      t.integer  :subscriber_id, null: false
      t.integer  :thread_id, null: false

      t.timestamps null: false
    end

    add_index :commontator_subscriptions, [:subscriber_id, :subscriber_type, :thread_id],
              unique: true,
              name: 'index_commontator_subscriptions_on_s_id_and_s_type_and_t_id'
    add_index :commontator_subscriptions, :thread_id

    create_table :commontator_threads do |t|
      t.string   :commontable_type
      t.integer  :commontable_id
      t.datetime :closed_at
      t.string   :closer_type
      t.integer  :closer_id

      t.timestamps null: false
    end

    add_index :commontator_threads, [:commontable_id, :commontable_type],
              unique: true,
              name: 'index_commontator_threads_on_c_id_and_c_type'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commontator-5.1.0 db/migrate/0_install_commontator.rb
commontator-5.0.0 db/migrate/0_install_commontator.rb