From 22f337109023ed9bef505867c42ea666c26dc1c2 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 29 Nov 2021 11:05:33 +0800 Subject: [PATCH] fix: change issues priority id default value --- app/controllers/pull_requests_controller.rb | 2 +- app/controllers/repositories_controller.rb | 2 +- app/models/issue.rb | 2 +- .../20211129025810_change_issues_priority_id_default.rb | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20211129025810_change_issues_priority_id_default.rb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index b897a1f96..c5ce396fb 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -288,7 +288,7 @@ class PullRequestsController < ApplicationController assigned_to_id: params[:assigned_to_id], fixed_version_id: params[:fixed_version_id], issue_tags_value: params[:issue_tag_ids].present? ? params[:issue_tag_ids].join(",") : "", - priority_id: params[:priority_id] || "2", + priority_id: params[:priority_id], issue_classify: "pull_request", issue_type: params[:issue_type] || "1", tracker_id: 2, diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 9b94f0d5d..caff386fc 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -340,7 +340,7 @@ class RepositoriesController < ApplicationController issue_type: "1", tracker_id: 2, status_id: 1, - priority_id: params[:priority_id] || "2" + priority_id: params[:priority_id] } @pull_issue = Issue.new(issue_params) if @pull_issue.save! diff --git a/app/models/issue.rb b/app/models/issue.rb index c642e642b..9c195d121 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -11,7 +11,7 @@ # category_id :integer # status_id :integer not null # assigned_to_id :integer -# priority_id :integer not null +# priority_id :integer # fixed_version_id :integer # author_id :integer not null # created_on :datetime diff --git a/db/migrate/20211129025810_change_issues_priority_id_default.rb b/db/migrate/20211129025810_change_issues_priority_id_default.rb new file mode 100644 index 000000000..bdb9cf362 --- /dev/null +++ b/db/migrate/20211129025810_change_issues_priority_id_default.rb @@ -0,0 +1,5 @@ +class ChangeIssuesPriorityIdDefault < ActiveRecord::Migration[5.2] + def change + change_column_null :issues, :priority_id, true + end +end