diff --git a/app/models/project/life_cycle_step.rb b/app/models/project/life_cycle_step.rb index 97f23f9339c1..90d4e74faffb 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 560f76044486..a1ec03892668 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 eb8081aed5f4..423eb83cac79 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 cabd9fc38081..bda8a4caefe6 100644 --- a/spec/models/work_package_spec.rb +++ b/spec/models/work_package_spec.rb @@ -70,7 +70,7 @@ 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) }