Get back `validates :key, uniqueness: { scope: :pipeline_schedule_id }` in `Ci::PipelineScheduleVariable` model
Description
When we implemented Pipeline schedule Variable, we didn't get validates :key, uniqueness: { scope: :pipeline_schedule_id }
in Ci::PipelineScheduleVariable
model https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12372.
This is because
validates :variables, variable_duplicates: true
accepts_nested_attributes_for :variables, allow_destroy: true
is conflicted with validates :key, uniqueness: { scope: :pipeline_schedule_id }
and it interuppts user to delete and create the same key through UI
But technically Ci::PipelineScheduleVariable
should have validates :key, uniqueness: { scope: :pipeline_schedule_id }
regardless of accepts_nested_attributes_for
.
Proposal
Get back validates :key, uniqueness: { scope: :pipeline_schedule_id }
in Ci::PipelineScheduleVariable
model