20180812162710_create_status_stats.rb 446 B

1234567891011121314
  1. # frozen_string_literal: true
  2. class CreateStatusStats < ActiveRecord::Migration[5.2]
  3. def change
  4. create_table :status_stats do |t|
  5. t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
  6. t.bigint :replies_count, null: false, default: 0
  7. t.bigint :reblogs_count, null: false, default: 0
  8. t.bigint :favourites_count, null: false, default: 0
  9. t.timestamps
  10. end
  11. end
  12. end