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
remove invalid project custom values
ulferts54d457bcfc52
diff --git a/db/migrate/20221202130039_fill_project_journals_with_existing_data.rb b/db/migrate/20221202130039_fill_project_journals_with_existing_data.rbindex c76b34094d9..e4c4d8c2214 100644--- a/db/migrate/20221202130039_fill_project_journals_with_existing_data.rb+++ b/db/migrate/20221202130039_fill_project_journals_with_existing_data.rb@@ -1,5 +1,8 @@class FillProjectJournalsWithExistingData < ActiveRecord::Migration[7.0]def up+ # On some user instances, invalid custom values were encountered. Those+ # custom_values belonged to projects which had been deleted in the meantime.+ delete_invalid_custom_valuescreate_journal_entries_for_projectsend@@ -94,4 +97,15 @@ class FillProjectJournalsWithExistingData < ActiveRecord::Migration[7.0]FROM project_journalsSQLend++ def delete_invalid_custom_values+ execute(<<~SQL.squish)+ DELETE+ FROM+ custom_values+ WHERE+ custom_values.customized_type = 'Project'+ AND NOT EXISTS (SELECT 1 FROM projects WHERE projects.id = custom_values.customized_id)+ SQL+ endend