Add original_heading_id to investments

Investments can be reclassified to a different heading during the participatory budget process.

Whilst we are recording this change of heading in the `previous_heading_id` attribute, we are only keeping the _last_ heading. If there are multiple reclassifications we lose this chain of reclassifications.

In this commit we are adding an `original_heading_id` attribute, that will only be set once, when creating the investment, and will not get lost with multiple reclassificaitons of an investment.
This commit is contained in:
voodoorai2000
2019-05-31 20:00:54 +02:00
committed by Javi Martín
parent 8670cafa2e
commit 488e19f8a0
4 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
class AddOriginalHeadingIdToInvestments < ActiveRecord::Migration[5.0]
def change
add_column :budget_investments, :original_heading_id, :integer
end
end

View File

@@ -294,6 +294,7 @@ ActiveRecord::Schema.define(version: 20190607160900) do
t.datetime "ignored_flag_at"
t.integer "flags_count", default: 0
t.integer "tracker_assignments_count"
t.integer "original_heading_id"
t.index ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree
t.index ["author_id"], name: "index_budget_investments_on_author_id", using: :btree
t.index ["community_id"], name: "index_budget_investments_on_community_id", using: :btree