Skip to content
代码片段 群组 项目
未验证 提交 4e75ccc7 编辑于 作者: Pavel Shutsin's avatar Pavel Shutsin 提交者: GitLab
浏览文件

Merge branch 'sk/464034-remove-not-null' into 'master'

Remove NOT NULL on policy_id for scan_result_policy_violations

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158372



Merged-by: default avatarPavel Shutsin <pshutsin@gitlab.com>
Approved-by: default avatarDominic Bauer <dbauer@gitlab.com>
Approved-by: default avatarPavel Shutsin <pshutsin@gitlab.com>
Co-authored-by: default avatarSashi Kumar <skumar@gitlab.com>
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
class RemoveScanResultPolicyViolationsPolicyIdNotNull < Gitlab::Database::Migration[2.2]
milestone '17.3'
disable_ddl_transaction!
def up
execute "ALTER TABLE scan_result_policy_violations ALTER COLUMN scan_result_policy_id DROP NOT NULL"
end
def down
execute "ALTER TABLE scan_result_policy_violations ALTER COLUMN scan_result_policy_id SET NOT NULL"
end
end
# frozen_string_literal: true
class AddApprovalPolicyIdConstraintToScanResultPolicyViolations < Gitlab::Database::Migration[2.2]
milestone '17.3'
disable_ddl_transaction!
CONSTRAINT_NAME = "chk_policy_violations_rule_id_or_policy_id_not_null"
def up
add_check_constraint :scan_result_policy_violations,
"approval_policy_rule_id IS NOT NULL OR scan_result_policy_id IS NOT NULL", CONSTRAINT_NAME
end
def down
remove_check_constraint :scan_result_policy_violations, CONSTRAINT_NAME
end
end
d4f8752b876eadad6821007240d02a834939877d5c8807379f48faaf39c5b34d
\ No newline at end of file
27e2a970e5e3f89527dedd4a9c0499b2aeb9236284b0174953d12f62ae4cd171
\ No newline at end of file
...@@ -17206,7 +17206,7 @@ ALTER SEQUENCE scan_result_policies_id_seq OWNED BY scan_result_policies.id; ...@@ -17206,7 +17206,7 @@ ALTER SEQUENCE scan_result_policies_id_seq OWNED BY scan_result_policies.id;
   
CREATE TABLE scan_result_policy_violations ( CREATE TABLE scan_result_policy_violations (
id bigint NOT NULL, id bigint NOT NULL,
scan_result_policy_id bigint NOT NULL, scan_result_policy_id bigint,
merge_request_id bigint NOT NULL, merge_request_id bigint NOT NULL,
project_id bigint NOT NULL, project_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL,
...@@ -17214,6 +17214,7 @@ CREATE TABLE scan_result_policy_violations ( ...@@ -17214,6 +17214,7 @@ CREATE TABLE scan_result_policy_violations (
violation_data jsonb, violation_data jsonb,
approval_policy_rule_id bigint, approval_policy_rule_id bigint,
status smallint DEFAULT 1 NOT NULL status smallint DEFAULT 1 NOT NULL
CONSTRAINT chk_policy_violations_rule_id_or_policy_id_not_null CHECK (((approval_policy_rule_id IS NOT NULL) OR (scan_result_policy_id IS NOT NULL)))
); );
   
CREATE SEQUENCE scan_result_policy_violations_id_seq CREATE SEQUENCE scan_result_policy_violations_id_seq
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册