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 lookup of journal_class, not only table
Oliver Günther3382a5eeaab0
diff --git a/db/migrate/20220818074159_fix_deleted_data_journals.rb b/db/migrate/20220818074159_fix_deleted_data_journals.rbindex d479affcf84..45a5d784016 100644--- a/db/migrate/20220818074159_fix_deleted_data_journals.rb+++ b/db/migrate/20220818074159_fix_deleted_data_journals.rb@@ -116,7 +116,7 @@ class FixDeletedDataJournals < ActiveRecord::Migration[7.0]Journal.pluck("DISTINCT(journable_type)").to_h do |journable_type|- table_name = lookup_journal_class_table(journable_type)+ journal_class, table_name = lookup_journal_class_table(journable_type)relation = Journal.joins("LEFT OUTER JOIN #{table_name} ON journals.data_type = '#{journal_class}' AND #{table_name}.id = journals.data_id").where("#{table_name}.id IS NULL")@@ -131,10 +131,10 @@ class FixDeletedDataJournals < ActiveRecord::Migration[7.0]# Lookup table for items that were already deleteddef lookup_journal_class_table(journable_type)- lookup = { "WikiContent" => "wiki_content_journals" }+ lookup = { "WikiContent" => %w[Journal::WikiContentJournal wiki_content_journals] }lookup.fetch(journable_type) dojournal_class = journable_type.constantize.journal_class- journal_class.table_name+ [journal_class.to_s, journal_class.table_name]endend