Commit 34d6a501 authored by Piotr Stankowski's avatar Piotr Stankowski

Add squash commit template column in project settings table

This commit adds squash_commit_template column in project_settings.
It also adds this field to project's model.
parent 06479426
...@@ -452,6 +452,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -452,6 +452,7 @@ class ProjectsController < Projects::ApplicationController
:packages_enabled, :packages_enabled,
:service_desk_enabled, :service_desk_enabled,
:merge_commit_template, :merge_commit_template,
:squash_commit_template,
project_setting_attributes: project_setting_attributes project_setting_attributes: project_setting_attributes
] + [project_feature_attributes: project_feature_attributes] ] + [project_feature_attributes: project_feature_attributes]
end end
......
...@@ -452,6 +452,7 @@ class Project < ApplicationRecord ...@@ -452,6 +452,7 @@ class Project < ApplicationRecord
to: :project_setting to: :project_setting
delegate :active?, to: :prometheus_integration, allow_nil: true, prefix: true delegate :active?, to: :prometheus_integration, allow_nil: true, prefix: true
delegate :merge_commit_template, :merge_commit_template=, to: :project_setting, allow_nil: true delegate :merge_commit_template, :merge_commit_template=, to: :project_setting, allow_nil: true
delegate :squash_commit_template, :squash_commit_template=, to: :project_setting, allow_nil: true
delegate :log_jira_dvcs_integration_usage, :jira_dvcs_server_last_sync_at, :jira_dvcs_cloud_last_sync_at, to: :feature_usage delegate :log_jira_dvcs_integration_usage, :jira_dvcs_server_last_sync_at, :jira_dvcs_cloud_last_sync_at, to: :feature_usage
......
...@@ -13,6 +13,7 @@ class ProjectSetting < ApplicationRecord ...@@ -13,6 +13,7 @@ class ProjectSetting < ApplicationRecord
self.primary_key = :project_id self.primary_key = :project_id
validates :merge_commit_template, length: { maximum: 500 } validates :merge_commit_template, length: { maximum: 500 }
validates :squash_commit_template, length: { maximum: 500 }
def squash_enabled_by_default? def squash_enabled_by_default?
%w[always default_on].include?(squash_option) %w[always default_on].include?(squash_option)
......
# frozen_string_literal: true
class AddSquashCommitTemplateToProjectSettings < Gitlab::Database::Migration[1.0]
enable_lock_retries!
def change
add_column :project_settings, :squash_commit_template, :text # rubocop:disable Migration/AddLimitToTextColumns
end
end
# frozen_string_literal: true
class AddSquashCommitTemplateLimitToProjectSettings < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
add_text_limit :project_settings, :squash_commit_template, 500
end
def down
remove_text_limit :project_settings, :squash_commit_template
end
end
d78fe687517e14ff67dc76eff63391e33b73d29446d2a0445595175c7cd6806a
\ No newline at end of file
c8ed7f8c0f818156dba9c25be848da97d4eb6dbf0aa9c48f87e940f3ca0967d9
\ No newline at end of file
...@@ -18284,7 +18284,9 @@ CREATE TABLE project_settings ( ...@@ -18284,7 +18284,9 @@ CREATE TABLE project_settings (
warn_about_potentially_unwanted_characters boolean DEFAULT true NOT NULL, warn_about_potentially_unwanted_characters boolean DEFAULT true NOT NULL,
merge_commit_template text, merge_commit_template text,
has_shimo boolean DEFAULT false NOT NULL, has_shimo boolean DEFAULT false NOT NULL,
squash_commit_template text,
CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)), CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)),
CONSTRAINT check_b09644994b CHECK ((char_length(squash_commit_template) <= 500)),
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)), CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)),
CONSTRAINT check_eaf7cfb6a7 CHECK ((char_length(merge_commit_template) <= 500)) CONSTRAINT check_eaf7cfb6a7 CHECK ((char_length(merge_commit_template) <= 500))
); );
...@@ -562,6 +562,7 @@ Project: ...@@ -562,6 +562,7 @@ Project:
- autoclose_referenced_issues - autoclose_referenced_issues
- suggestion_commit_message - suggestion_commit_message
- merge_commit_template - merge_commit_template
- squash_commit_template
ProjectTracingSetting: ProjectTracingSetting:
- external_url - external_url
Author: Author:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment