From 30837ad1319f263f81d381ec81a0ffb349d1681d Mon Sep 17 00:00:00 2001 From: nilsding Date: Sun, 2 Nov 2014 17:58:09 +0100 Subject: [PATCH] added some counters (followers, friends, ...) to the users table --- db/migrate/20141102153520_add_counts_to_users.rb | 9 +++++++++ db/schema.rb | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20141102153520_add_counts_to_users.rb diff --git a/db/migrate/20141102153520_add_counts_to_users.rb b/db/migrate/20141102153520_add_counts_to_users.rb new file mode 100644 index 00000000..d38c009b --- /dev/null +++ b/db/migrate/20141102153520_add_counts_to_users.rb @@ -0,0 +1,9 @@ +class AddCountsToUsers < ActiveRecord::Migration + def change + add_column :users, :friend_count, :integer, default: 0, null: false + add_column :users, :follower_count, :integer, default: 0, null: false + add_column :users, :asked_count, :integer, default: 0, null: false + add_column :users, :answered_count, :integer, default: 0, null: false + add_column :users, :commented_count, :integer, default: 0, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index b25cca5d..c68efab2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140801175137) do +ActiveRecord::Schema.define(version: 20141102153520) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -64,6 +64,11 @@ ActiveRecord::Schema.define(version: 20140801175137) do t.datetime "created_at" t.datetime "updated_at" t.string "screen_name" + t.integer "friend_count", default: 0, null: false + t.integer "follower_count", default: 0, null: false + t.integer "asked_count", default: 0, null: false + t.integer "answered_count", default: 0, null: false + t.integer "commented_count", default: 0, null: false end add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree