summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20130706103848_add_creations_count_to_users.rb13
-rw-r--r--db/schema.rb3
2 files changed, 15 insertions, 1 deletions
diff --git a/db/migrate/20130706103848_add_creations_count_to_users.rb b/db/migrate/20130706103848_add_creations_count_to_users.rb
new file mode 100644
index 00000000..e7f7b048
--- /dev/null
+++ b/db/migrate/20130706103848_add_creations_count_to_users.rb
@@ -0,0 +1,13 @@
+class AddCreationsCountToUsers < ActiveRecord::Migration
+ def up
+ add_column :users, :creations_count, :integer, :default => 0
+ User.reset_column_information
+ User.find_each do |user|
+ User.reset_counters user.id, :creations
+ end
+ end
+
+ def down
+ remove_column :users, :creations_count
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 12c9cdc9..cb643854 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130702213105) do
+ActiveRecord::Schema.define(:version => 20130706103848) do
create_table "active_admin_comments", :force => true do |t|
t.integer "resource_id", :null => false
@@ -229,6 +229,7 @@ ActiveRecord::Schema.define(:version => 20130702213105) do
t.string "authentication_token"
t.string "invitation_token"
t.string "full_address"
+ t.integer "creations_count", :default => 0
end
add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true