added some counters (followers, friends, ...) to the users table

This commit is contained in:
nilsding 2014-11-02 17:58:09 +01:00
parent c211b29395
commit 30837ad131
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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