From 8e111b753a3411b258cdb008c9a53bad696f4df1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 14 Aug 2018 19:19:32 +0200 Subject: Move status counters to separate table, count replies (#8104) * Move status counters to separate table, count replies * Migration to remove old counter columns from statuses table * Fix schema file --- db/migrate/20180812162710_create_status_stats.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 db/migrate/20180812162710_create_status_stats.rb (limited to 'db/migrate/20180812162710_create_status_stats.rb') diff --git a/db/migrate/20180812162710_create_status_stats.rb b/db/migrate/20180812162710_create_status_stats.rb new file mode 100644 index 000000000..d4da36fe7 --- /dev/null +++ b/db/migrate/20180812162710_create_status_stats.rb @@ -0,0 +1,12 @@ +class CreateStatusStats < ActiveRecord::Migration[5.2] + def change + create_table :status_stats do |t| + t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } + t.bigint :replies_count, null: false, default: 0 + t.bigint :reblogs_count, null: false, default: 0 + t.bigint :favourites_count, null: false, default: 0 + + t.timestamps + end + end +end -- cgit