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

project life cycle step journal model and migration

Ivan Kuchin96d8215e8688
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 2ba7da25dd8..2863987eb6f 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -98,6 +98,7 @@ class Journal < ApplicationRecord
has_many :agenda_item_journals, class_name: "Journal::MeetingAgendaItemJournal", dependent: :delete_all
has_many :attachable_journals, class_name: "Journal::AttachableJournal", dependent: :delete_all
has_many :customizable_journals, class_name: "Journal::CustomizableJournal", dependent: :delete_all
+ has_many :project_life_cycle_step_journals, class_name: "Journal::ProjectLifeCycleStepJournal", dependent: :delete_all
has_many :storable_journals, class_name: "Journal::StorableJournal", dependent: :delete_all
has_many :notifications, dependent: :destroy
diff --git a/app/models/journal/project_life_cycle_step_journal.rb b/app/models/journal/project_life_cycle_step_journal.rb
new file mode 100644
index 00000000000..8e3200ce706
--- /dev/null
+++ b/app/models/journal/project_life_cycle_step_journal.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class Journal::ProjectLifeCycleStepJournal < Journal::AssociatedJournal
+ self.table_name = "project_life_cycle_step_journals"
+
+ belongs_to :life_cycle_step, class_name: "Project::LifeCycleStep"
+end
diff --git a/db/migrate/20250114162956_create_project_life_cycle_step_journals.rb b/db/migrate/20250114162956_create_project_life_cycle_step_journals.rb
new file mode 100644
index 00000000000..012b7377fbc
--- /dev/null
+++ b/db/migrate/20250114162956_create_project_life_cycle_step_journals.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class CreateProjectLifeCycleStepJournals < ActiveRecord::Migration[7.1]
+ def change
+ create_table :project_life_cycle_step_journals do |t| # rubocop:disable Rails/CreateTableWithTimestamps
+ t.belongs_to :journal, null: false, foreign_key: true
+ t.belongs_to :life_cycle_step, null: false
+
+ t.date :start_date
+ t.date :end_date
+ t.boolean :active, default: false, null: false
+ end
+ end
+end