Merge pull request #2406 from consul/totally_remove_investment_interal_comment

Totally remove investment's internal_comments
This commit is contained in:
Alberto Calderón Queimadelos
2018-03-09 13:37:50 +01:00
committed by GitHub
4 changed files with 5 additions and 14 deletions

View File

@@ -0,0 +1,5 @@
class RemoveInternalCommentsFromInvestment < ActiveRecord::Migration
def change
remove_column :budget_investments, :internal_comments
end
end

View File

@@ -136,7 +136,6 @@ ActiveRecord::Schema.define(version: 20180220211105) do
t.string "feasibility", limit: 15, default: "undecided"
t.text "price_explanation"
t.text "unfeasibility_explanation"
t.text "internal_comments"
t.boolean "valuation_finished", default: false
t.integer "valuator_assignments_count", default: 0
t.integer "price_first_year", limit: 8

View File

@@ -32,7 +32,6 @@ class MigrateSpendingProposalsToInvestments
external_url: sp.external_url,
price: sp.price,
price_explanation: sp.price_explanation,
internal_comments: sp.internal_comments,
duration: sp.time_scope,
feasibility: feasibility,
unfeasibility_explanation: sp.feasible_explanation,

View File

@@ -1,12 +0,0 @@
namespace :investments do
namespace :internal_comments do
desc "Migrate internal_comments textarea to a first comment on internal thread"
task migrate_to_thread: :environment do
comments_author_id = Administrator.first.user.id
Budget::Investment.where.not(internal_comments: [nil, '']).find_each do |investment|
Comment.create(commentable: investment, user_id: comments_author_id,
body: investment.internal_comments, valuation: true)
end
end
end
end