Skip to content

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

Ensure journals.notes column accepts NULL values

Christophe Bliard42576f1323ab
diff --git a/db/migrate/20221202130039_fill_project_journals_with_existing_data.rb b/db/migrate/20221202130039_fill_project_journals_with_existing_data.rb
index e4c4d8c2214..3f87957d321 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,6 @@
class FillProjectJournalsWithExistingData < ActiveRecord::Migration[7.0]
def up
+ make_sure_journals_notes_is_nullable
# 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_values
@@ -12,6 +13,10 @@ class FillProjectJournalsWithExistingData < ActiveRecord::Migration[7.0]
private
+ def make_sure_journals_notes_is_nullable
+ change_column_null(:journals, :notes, true)
+ end
+
def create_journal_entries_for_projects
sql = <<~SQL.squish
WITH project_journals_insertion AS (