diff --git a/dbm-ui/backend/configuration/constants.py b/dbm-ui/backend/configuration/constants.py index 317f834f68..a10e19be90 100644 --- a/dbm-ui/backend/configuration/constants.py +++ b/dbm-ui/backend/configuration/constants.py @@ -108,6 +108,7 @@ class BizSettingsEnum(str, StructuredEnum): INDEPENDENT_HOSTING_DB_TYPES = EnumField("INDEPENDENT_HOSTING_DB_TYPES", _("独立托管机器的数据库类型")) # TODO: 后续待删除 SKIP_GRAMMAR_CHECK = EnumField("SKIP_GRAMMAR_CHECK", _("是否跳过语义检查")) + SQL_IMPORT_FORCE_ITSM = EnumField("SQL_IMPORT_FORCE_ITSM", _("是否变更SQL强制需要审批流")) DEFAULT_DB_ADMINISTRATORS = ["admin"] diff --git a/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py b/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py index 14a718aeca..9bfb2960b7 100644 --- a/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py +++ b/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py @@ -16,7 +16,8 @@ from backend import env from backend.components.sql_import.client import SQLSimulationApi -from backend.configuration.constants import DBType +from backend.configuration.constants import BizSettingsEnum, DBType +from backend.configuration.models import BizSettings from backend.db_services.mysql.sql_import.constants import SQLExecuteTicketMode from backend.db_services.mysql.sql_import.handlers import SQLHandler from backend.flow.engine.bamboo.engine import BambooEngine @@ -113,6 +114,10 @@ class MysqlSqlImportFlowBuilder(BaseMySQLTicketFlowBuilder): @property def need_itsm(self): + # 业务强制需要审批流 + force_need_itsm = BizSettings.get_setting_value(self.ticket.bk_biz_id, BizSettingsEnum.SQL_IMPORT_FORCE_ITSM) + if force_need_itsm: + return True # 非高危的SQL变更单据,不需要审批节点 grammar_check_info = self.ticket.details["grammar_check_info"].values() high_risk = [check["highrisk_warnings"] for check in grammar_check_info if check["highrisk_warnings"]]