about summary refs log tree commit diff
path: root/db/migrate/20181116165755_create_account_stats.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-11-19 00:43:52 +0100
committerGitHub <noreply@github.com>2018-11-19 00:43:52 +0100
commitd6b9a62e0a13497b8cc40eb1db56d1ec2b3760ea (patch)
treef8627888dd9dce43f66427261a90a3e9886b4df7 /db/migrate/20181116165755_create_account_stats.rb
parent4fdefffb9906ffc3e5fde7af652674bebffd6e15 (diff)
Extract counters from accounts table to account_stats table (#9295)
Diffstat (limited to 'db/migrate/20181116165755_create_account_stats.rb')
-rw-r--r--db/migrate/20181116165755_create_account_stats.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/db/migrate/20181116165755_create_account_stats.rb b/db/migrate/20181116165755_create_account_stats.rb
new file mode 100644
index 000000000..a798e8166
--- /dev/null
+++ b/db/migrate/20181116165755_create_account_stats.rb
@@ -0,0 +1,12 @@
+class CreateAccountStats < ActiveRecord::Migration[5.2]
+  def change
+    create_table :account_stats do |t|
+      t.belongs_to :account, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
+      t.bigint :statuses_count, null: false, default: 0
+      t.bigint :following_count, null: false, default: 0
+      t.bigint :followers_count, null: false, default: 0
+
+      t.timestamps
+    end
+  end
+end