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
add unique constraint for life cycle step definition name
Ivan Kuchina7756b81db2c
diff --git a/app/models/project/life_cycle_step_definition.rb b/app/models/project/life_cycle_step_definition.rbindex 0aadf22d084..f80cc611693 100644--- a/app/models/project/life_cycle_step_definition.rb+++ b/app/models/project/life_cycle_step_definition.rb@@ -35,7 +35,7 @@ class Project::LifeCycleStepDefinition < ApplicationRecordhas_many :projects, through: :life_cycle_stepsbelongs_to :color, optional: false- validates :name, presence: true+ validates :name, presence: true, uniqueness: truevalidates :type, inclusion: { in: %w[Project::StageDefinition Project::GateDefinition], message: :must_be_a_stage_or_gate }validate :validate_type_and_class_name_are_identicaldiff --git a/db/migrate/20241217190533_add_uniqueness_index_to_project_life_cycle_step_definitions_name.rb b/db/migrate/20241217190533_add_uniqueness_index_to_project_life_cycle_step_definitions_name.rbnew file mode 100644index 00000000000..f6aba362e52--- /dev/null+++ b/db/migrate/20241217190533_add_uniqueness_index_to_project_life_cycle_step_definitions_name.rb@@ -0,0 +1,5 @@+class AddUniquenessIndexToProjectLifeCycleStepDefinitionsName < ActiveRecord::Migration[7.1]+ def change+ add_index :project_life_cycle_step_definitions, :name, unique: true+ end+end