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

Rename WorkPackage#life_cycle_step to #project_life_cycle_step

Dombi Attila1a9d77e4a6ad
diff --git a/app/models/project/life_cycle_step.rb b/app/models/project/life_cycle_step.rb
index 97f23f9339c..90d4e74faff 100644
--- a/app/models/project/life_cycle_step.rb
+++ b/app/models/project/life_cycle_step.rb
@@ -31,7 +31,7 @@ class Project::LifeCycleStep < ApplicationRecord
belongs_to :definition,
optional: false,
class_name: "Project::LifeCycleStepDefinition"
- has_many :work_packages, inverse_of: :life_cycle_step, dependent: :nullify
+ has_many :work_packages, inverse_of: :project_life_cycle_step, dependent: :nullify
attr_readonly :definition_id
diff --git a/app/models/work_package.rb b/app/models/work_package.rb
index 560f7604448..a1ec0389266 100644
--- a/app/models/work_package.rb
+++ b/app/models/work_package.rb
@@ -54,7 +54,7 @@ class WorkPackage < ApplicationRecord
belongs_to :assigned_to, class_name: "Principal", optional: true
belongs_to :responsible, class_name: "Principal", optional: true
belongs_to :version, optional: true
- belongs_to :life_cycle_step, class_name: "Project::LifeCycleStep", optional: true
+ belongs_to :project_life_cycle_step, class_name: "Project::LifeCycleStep", optional: true
belongs_to :priority, class_name: "IssuePriority"
belongs_to :category, class_name: "Category", optional: true
diff --git a/db/migrate/20241105175000_add_life_cycle_to_work_packages.rb b/db/migrate/20241105175000_add_life_cycle_to_work_packages.rb
index eb8081aed5f..423eb83cac7 100644
--- a/db/migrate/20241105175000_add_life_cycle_to_work_packages.rb
+++ b/db/migrate/20241105175000_add_life_cycle_to_work_packages.rb
@@ -1,8 +1,5 @@
class AddLifeCycleToWorkPackages < ActiveRecord::Migration[7.1]
def change
- add_reference :work_packages,
- :life_cycle_step,
- foreign_key: { to_table: :project_life_cycle_steps },
- null: true
+ add_reference :work_packages, :project_life_cycle_step, null: true
end
end
diff --git a/spec/models/work_package_spec.rb b/spec/models/work_package_spec.rb
index cabd9fc3808..bda8a4caefe 100644
--- a/spec/models/work_package_spec.rb
+++ b/spec/models/work_package_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe WorkPackage do
it { is_expected.to belong_to(:assigned_to).class_name("Principal").optional }
it { is_expected.to belong_to(:responsible).class_name("Principal").optional }
it { is_expected.to belong_to(:version).optional }
- it { is_expected.to belong_to(:life_cycle_step).class_name("Project::LifeCycleStep").optional }
+ it { is_expected.to belong_to(:project_life_cycle_step).class_name("Project::LifeCycleStep").optional }
it { is_expected.to belong_to(:priority).class_name("IssuePriority") }
it { is_expected.to belong_to(:category).optional }
it { is_expected.to have_many(:time_entries).dependent(:delete_all) }