OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix BCF Comments with references to Viewpoint when VP gets deleted.
Wieland Lindenthal8f60a99eee0a
diff --git a/modules/bcf/app/models/bcf/comment.rb b/modules/bcf/app/models/bcf/comment.rbindex 1f541f76497..16c6e7bebb8 100644--- a/modules/bcf/app/models/bcf/comment.rb+++ b/modules/bcf/app/models/bcf/comment.rb@@ -4,7 +4,7 @@ module Bcfbelongs_to :journalbelongs_to :issue, foreign_key: :issue_id, class_name: "Bcf::Issue"- belongs_to :viewpoint, foreign_key: :viewpoint_id, class_name: "Bcf::Viewpoint"+ belongs_to :viewpoint, foreign_key: :viewpoint_id, class_name: "Bcf::Viewpoint", optional: truevalidates_presence_of :uuidvalidates_uniqueness_of :uuid, scope: [:issue_id]diff --git a/modules/bcf/db/migrate/20200123163818_add_on_delete_nullify_to_bcf_comment_foreign_key_to_viewpoint.rb b/modules/bcf/db/migrate/20200123163818_add_on_delete_nullify_to_bcf_comment_foreign_key_to_viewpoint.rbnew file mode 100644index 00000000000..def8e2844ca--- /dev/null+++ b/modules/bcf/db/migrate/20200123163818_add_on_delete_nullify_to_bcf_comment_foreign_key_to_viewpoint.rb@@ -0,0 +1,6 @@+class AddOnDeleteNullifyToBcfCommentForeignKeyToViewpoint < ActiveRecord::Migration[6.0]+ def change+ remove_reference :bcf_comments, :viewpoint+ add_reference :bcf_comments, :viewpoint, foreign_key: { to_table: :bcf_viewpoints, on_delete: :nullify }, index: true+ end+end