adds counter cache for assignments
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
class ValuationAssignment < ActiveRecord::Base
|
class ValuationAssignment < ActiveRecord::Base
|
||||||
belongs_to :valuator
|
belongs_to :valuator
|
||||||
belongs_to :spending_proposal
|
belongs_to :spending_proposal, counter_cache: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddAssignmentsCounterCacheToSpendingProposal < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :spending_proposals, :valuation_assignments_count, :integer, default: 0
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160224123110) do
|
ActiveRecord::Schema.define(version: 20160225171916) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -296,8 +296,8 @@ ActiveRecord::Schema.define(version: 20160224123110) do
|
|||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.string "external_url"
|
t.string "external_url"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "geozone_id"
|
t.integer "geozone_id"
|
||||||
t.float "price"
|
t.float "price"
|
||||||
t.boolean "feasible"
|
t.boolean "feasible"
|
||||||
@@ -305,9 +305,10 @@ ActiveRecord::Schema.define(version: 20160224123110) do
|
|||||||
t.text "price_explanation"
|
t.text "price_explanation"
|
||||||
t.text "feasible_explanation"
|
t.text "feasible_explanation"
|
||||||
t.text "internal_comments"
|
t.text "internal_comments"
|
||||||
t.boolean "valuation_finished", default: false
|
t.boolean "valuation_finished", default: false
|
||||||
t.text "explanations_log"
|
t.text "explanations_log"
|
||||||
t.integer "administrator_id"
|
t.integer "administrator_id"
|
||||||
|
t.integer "valuation_assignments_count", default: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree
|
add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree
|
||||||
|
|||||||
Reference in New Issue
Block a user