Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: rename schema system to sql review (#1863)
ecmadao2a79b022c51f
diff --git a/api/plan.go b/api/plan.goindex 3e121d19c4..6ef55cc596 100644--- a/api/plan.go+++ b/api/plan.go@@ -82,10 +82,10 @@ const (// e.g. One can configure to NOT require backup for dev environment while require// weekly backup for staging and daily backup for production.FeatureBackupPolicy FeatureType = "bb.feature.backup-policy"- // FeatureSchemaReviewPolicy allows user to specify schema policy for the environment+ // FeatureSQLReviewPolicy allows user to specify schema policy for the environment//// e.g. One can configure rules for database schema or SQL query.- FeatureSchemaReviewPolicy FeatureType = "bb.feature.schema-review-policy"+ FeatureSQLReviewPolicy FeatureType = "bb.feature.sql-review"// Admin & Security@@ -129,8 +129,8 @@ func (e FeatureType) Name() string {return "Approval policy"case FeatureBackupPolicy:return "Backup policy"- case FeatureSchemaReviewPolicy:- return "Schema review policy"+ case FeatureSQLReviewPolicy:+ return "SQL review policy"case FeatureRBAC:return "RBAC"case Feature3rdPartyAuth:@@ -160,19 +160,19 @@ func (e FeatureType) minimumSupportedPlan() PlanType {// FeatureMatrix is a map from the a particular feature to the respective enablement of a particular planvar FeatureMatrix = map[FeatureType][3]bool{- "bb.feature.schema-drift": {false, true, true},- "bb.feature.task-schedule-time": {false, true, true},- "bb.feature.multi-tenancy": {false, true, true},- "bb.feature.dba-workflow": {false, false, true},- "bb.feature.data-source": {false, false, false},- "bb.feature.ghost": {false, true, true},- "bb.feature.pitr": {false, true, true},- "bb.feature.approval-policy": {false, true, true},- "bb.feature.backup-policy": {false, true, true},- "bb.feature.schema-review-policy": {false, true, true},- "bb.feature.rbac": {false, true, true},- "bb.feature.3rd-party-auth": {false, true, true},- "bb.feature.branding": {false, true, true},+ "bb.feature.schema-drift": {false, true, true},+ "bb.feature.task-schedule-time": {false, true, true},+ "bb.feature.multi-tenancy": {false, true, true},+ "bb.feature.dba-workflow": {false, false, true},+ "bb.feature.data-source": {false, false, false},+ "bb.feature.ghost": {false, true, true},+ "bb.feature.pitr": {false, true, true},+ "bb.feature.approval-policy": {false, true, true},+ "bb.feature.backup-policy": {false, true, true},+ "bb.feature.sql-review": {false, true, true},+ "bb.feature.rbac": {false, true, true},+ "bb.feature.3rd-party-auth": {false, true, true},+ "bb.feature.branding": {false, true, true},}// Plan is the API message for a plan.diff --git a/api/policy.go b/api/policy.goindex 3770998b1e..50c940dafb 100644--- a/api/policy.go+++ b/api/policy.go@@ -158,9 +158,9 @@ func UnmarshalBackupPlanPolicy(payload string) (*BackupPlanPolicy, error) {return &bp, nil}-// UnmarshalSchemaReviewPolicy will unmarshal payload to schema review policy.-func UnmarshalSchemaReviewPolicy(payload string) (*advisor.SchemaReviewPolicy, error) {- var sr advisor.SchemaReviewPolicy+// UnmarshalSQLReviewPolicy will unmarshal payload to schema review policy.+func UnmarshalSQLReviewPolicy(payload string) (*advisor.SQLReviewPolicy, error) {+ var sr advisor.SQLReviewPolicyif err := json.Unmarshal([]byte(payload), &sr); err != nil {return nil, fmt.Errorf("failed to unmarshal schema review policy %q: %q", payload, err)}@@ -194,7 +194,7 @@ func ValidatePolicy(pType PolicyType, payload string) error {return fmt.Errorf("invalid backup plan policy schedule: %q", bp.Schedule)}case PolicyTypeSchemaReview:- sr, err := UnmarshalSchemaReviewPolicy(payload)+ sr, err := UnmarshalSQLReviewPolicy(payload)if err != nil {return err}diff --git a/api/task_check_run.go b/api/task_check_run.goindex 053a664220..bf684e2467 100644--- a/api/task_check_run.go+++ b/api/task_check_run.go@@ -208,15 +208,15 @@ func IsSyntaxCheckSupported(dbType db.Type, mode common.ReleaseMode) bool {return false}-// IsSchemaReviewSupported checks the engine type if schema review supports it.-func IsSchemaReviewSupported(dbType db.Type, mode common.ReleaseMode) bool {+// IsSQLReviewSupported checks the engine type if schema review supports it.+func IsSQLReviewSupported(dbType db.Type, mode common.ReleaseMode) bool {if mode == common.ReleaseModeDev || dbType == db.MySQL || dbType == db.TiDB {advisorDB, err := ConvertToAdvisorDBType(dbType)if err != nil {return false}- return advisor.IsSchemaReviewSupported(advisorDB)+ return advisor.IsSQLReviewSupported(advisorDB)}return falsediff --git a/frontend/src/components/Breadcrumb.vue b/frontend/src/components/Breadcrumb.vueindex 35206d8679..4305cd91f3 100644--- a/frontend/src/components/Breadcrumb.vue+++ b/frontend/src/components/Breadcrumb.vue@@ -103,7 +103,7 @@ export default defineComponent({const dataSourceSlug = routeSlug.dataSourceSlug;const migrationHistory = routeSlug.migrationHistorySlug;const versionControlSlug = routeSlug.vcsSlug;- const schemaReviewPolicySlug = routeSlug.schemaReviewPolicySlug;+ const sqlReviewPolicySlug = routeSlug.sqlReviewPolicySlug;const list: Array<BreadcrumbItem> = [];if (environmentSlug) {@@ -155,10 +155,10 @@ export default defineComponent({name: t("common.version-control"),path: "/setting/version-control",});- } else if (schemaReviewPolicySlug) {+ } else if (sqlReviewPolicySlug) {list.push({- name: t("schema-review-policy.title"),- path: "/setting/schema-review-policy",+ name: t("sql-review.title"),+ path: "/setting/sql-review",});}diff --git a/frontend/src/components/EnvironmentForm.vue b/frontend/src/components/EnvironmentForm.vueindex 9b803c238e..373da54c01 100644--- a/frontend/src/components/EnvironmentForm.vue+++ b/frontend/src/components/EnvironmentForm.vue@@ -137,30 +137,30 @@</div><div v-if="!create" class="col-span-1"><label class="textlabel">- {{ $t("schema-review-policy.title") }}+ {{ $t("sql-review.title") }}</label><div class="mt-3"><button- v-if="schemaReviewPolicy"+ v-if="sqlReviewPolicy"type="button"class="text-sm font-medium text-accent hover:underline"- @click.prevent="onSchemaReviewPolicyClick"+ @click.prevent="onSQLReviewPolicyClick">- {{ schemaReviewPolicy.name }}- <span v-if="schemaReviewPolicy.rowStatus == 'ARCHIVED'">- ({{ $t("schema-review-policy.disabled") }})+ {{ sqlReviewPolicy.name }}+ <span v-if="sqlReviewPolicy.rowStatus == 'ARCHIVED'">+ ({{ $t("sql-review.disabled") }})</span></button><buttonv-else-if="hasPermission"type="button"class="btn-normal py-2 px-4 gap-x-1 items-center"- @click.prevent="onSchemaReviewPolicyClick"+ @click.prevent="onSQLReviewPolicyClick">- {{ $t("schema-review-policy.configure-policy") }}+ {{ $t("sql-review.configure-policy") }}</button><span v-else class="textinfolabel">- {{ $t("schema-review-policy.no-policy-set") }}+ {{ $t("sql-review.no-policy-set") }}</span></div></div>@@ -252,14 +252,10 @@ import {EnvironmentCreate,EnvironmentPatch,Policy,- DatabaseSchemaReviewPolicy,+ SQLReviewPolicy,} from "../types";-import { isDev, isDBAOrOwner, schemaReviewPolicySlug } from "../utils";-import {- useCurrentUser,- useEnvironmentList,- useSchemaSystemStore,-} from "@/store";+import { isDev, isDBAOrOwner, sqlReviewPolicySlug } from "../utils";+import { useCurrentUser, useEnvironmentList, useSQLReviewStore } from "@/store";interface LocalState {environment: Environment | EnvironmentCreate;@@ -267,7 +263,7 @@ interface LocalState {backupPolicy: Policy;}-const ROUTE_NAME = "setting.workspace.schema-review-policy";+const ROUTE_NAME = "setting.workspace.sql-review";export default defineComponent({name: "EnvironmentForm",@@ -298,7 +294,7 @@ export default defineComponent({});const router = useRouter();- const schemaSystemStore = useSchemaSystemStore();+ const sqlReviewStore = useSQLReviewStore();const environmentId = computed(() => {if (props.create) {@@ -307,35 +303,29 @@ export default defineComponent({return (props.environment as Environment).id;});- const prepareSchemaReviewPolicy = () => {+ const prepareSQLReviewPolicy = () => {if (!environmentId.value) {return;}- return schemaSystemStore.fetchReviewPolicyByEnvironmentId(+ return sqlReviewStore.fetchReviewPolicyByEnvironmentId(environmentId.value);};- watchEffect(prepareSchemaReviewPolicy);+ watchEffect(prepareSQLReviewPolicy);- const schemaReviewPolicy = computed(- (): DatabaseSchemaReviewPolicy | undefined => {- if (!environmentId.value) {- return;- }- return schemaSystemStore.getReviewPolicyByEnvironmentId(- environmentId.value- );+ const sqlReviewPolicy = computed((): SQLReviewPolicy | undefined => {+ if (!environmentId.value) {+ return;}- );+ return sqlReviewStore.getReviewPolicyByEnvironmentId(environmentId.value);+ });- const onSchemaReviewPolicyClick = () => {- if (schemaReviewPolicy.value) {+ const onSQLReviewPolicyClick = () => {+ if (sqlReviewPolicy.value) {router.push({name: `${ROUTE_NAME}.detail`,params: {- schemaReviewPolicySlug: schemaReviewPolicySlug(- schemaReviewPolicy.value- ),+ sqlReviewPolicySlug: sqlReviewPolicySlug(sqlReviewPolicy.value),},});} else {@@ -479,8 +469,8 @@ export default defineComponent({updateEnvironment,archiveEnvironment,restoreEnvironment,- schemaReviewPolicy,- onSchemaReviewPolicyClick,+ sqlReviewPolicy,+ onSQLReviewPolicyClick,};},});diff --git a/frontend/src/components/InputWithTemplate/InputWithTemplate.vue b/frontend/src/components/InputWithTemplate/InputWithTemplate.vueindex 52301b06cf..d876e7321d 100644--- a/frontend/src/components/InputWithTemplate/InputWithTemplate.vue+++ b/frontend/src/components/InputWithTemplate/InputWithTemplate.vue@@ -8,7 +8,7 @@@click="() => onTemplateAdd(template)">{{ template.id }}- <span class="tooltip whitespace-nowrap" v-if="template.description">{{+ <span v-if="template.description" class="tooltip whitespace-nowrap">{{$t(template.description)}}</span></div>diff --git a/frontend/src/components/Issue/IssueDetailLayout.vue b/frontend/src/components/Issue/IssueDetailLayout.vueindex f5f6d56b83..d6173b8f9c 100644--- a/frontend/src/components/Issue/IssueDetailLayout.vue+++ b/frontend/src/components/Issue/IssueDetailLayout.vue@@ -14,14 +14,12 @@</IssueHighlightPanel></div>- <!-- Remind banner for bb.feature.schema-review-policy -->+ <!-- Remind banner for bb.feature.sql-review --><FeatureAttention- v-if="!hasSchemaReviewPolicyFeature"+ v-if="!hasSQLReviewPolicyFeature"custom-class="m-5 mt-0"- feature="bb.feature.schema-review-policy"- :description="- $t('subscription.features.bb-feature-schema-review-policy.desc')- "+ feature="bb.feature.sql-review"+ :description="$t('subscription.features.bb-feature-sql-review.desc')"/><!-- Stage Flow Bar -->@@ -281,9 +279,7 @@ onMounted(() => {document.getElementById("issue-detail-top")!.scrollIntoView();});-const hasSchemaReviewPolicyFeature = featureToRef(- "bb.feature.schema-review-policy"-);+const hasSQLReviewPolicyFeature = featureToRef("bb.feature.sql-review");watch([create, issue, () => route.query.sql as string, issueLogic],diff --git a/frontend/src/components/Issue/TaskCheckRunPanel.vue b/frontend/src/components/Issue/TaskCheckRunPanel.vueindex e803e6870e..f692cd11cb 100644--- a/frontend/src/components/Issue/TaskCheckRunPanel.vue+++ b/frontend/src/components/Issue/TaskCheckRunPanel.vue@@ -62,7 +62,7 @@ import {GeneralErrorCode,ruleTemplateMap,getRuleLocalization,- SchemaReviewPolicyErrorCode,+ SQLReviewPolicyErrorCode,RuleType,} from "@/types";@@ -137,21 +137,21 @@ export default defineComponent({let title = "";switch (checkResult.code) {- case SchemaReviewPolicyErrorCode.EMPTY_POLICY:+ case SQLReviewPolicyErrorCode.EMPTY_POLICY:title = checkResult.title;break;- case SchemaReviewPolicyErrorCode.STATEMENT_NO_WHERE:- case SchemaReviewPolicyErrorCode.STATEMENT_NO_SELECT_ALL:- case SchemaReviewPolicyErrorCode.STATEMENT_LEADING_WILDCARD_LIKE:- case SchemaReviewPolicyErrorCode.TABLE_NAMING_DISMATCH:- case SchemaReviewPolicyErrorCode.COLUMN_NAMING_DISMATCH:- case SchemaReviewPolicyErrorCode.INDEX_NAMING_DISMATCH:- case SchemaReviewPolicyErrorCode.UK_NAMING_DISMATCH:- case SchemaReviewPolicyErrorCode.FK_NAMING_DISMATCH:- case SchemaReviewPolicyErrorCode.NO_REQUIRED_COLUMN:- case SchemaReviewPolicyErrorCode.COLUMN_CANBE_NULL:- case SchemaReviewPolicyErrorCode.NOT_INNODB_ENGINE:- case SchemaReviewPolicyErrorCode.NO_PK_IN_TABLE:+ case SQLReviewPolicyErrorCode.STATEMENT_NO_WHERE:+ case SQLReviewPolicyErrorCode.STATEMENT_NO_SELECT_ALL:+ case SQLReviewPolicyErrorCode.STATEMENT_LEADING_WILDCARD_LIKE:+ case SQLReviewPolicyErrorCode.TABLE_NAMING_DISMATCH:+ case SQLReviewPolicyErrorCode.COLUMN_NAMING_DISMATCH:+ case SQLReviewPolicyErrorCode.INDEX_NAMING_DISMATCH:+ case SQLReviewPolicyErrorCode.UK_NAMING_DISMATCH:+ case SQLReviewPolicyErrorCode.FK_NAMING_DISMATCH:+ case SQLReviewPolicyErrorCode.NO_REQUIRED_COLUMN:+ case SQLReviewPolicyErrorCode.COLUMN_CANBE_NULL:+ case SQLReviewPolicyErrorCode.NOT_INNODB_ENGINE:+ case SQLReviewPolicyErrorCode.NO_PK_IN_TABLE:const rule = ruleTemplateMap.get(checkResult.title as RuleType);if (rule) {@@ -172,11 +172,11 @@ export default defineComponent({switch (code) {case GeneralErrorCode.OK:return;- case SchemaReviewPolicyErrorCode.EMPTY_POLICY:+ case SQLReviewPolicyErrorCode.EMPTY_POLICY:return {- title: t("schema-review-policy.configure-policy"),+ title: t("sql-review.configure-policy"),target: "_self",- url: "/setting/schema-review-policy",+ url: "/setting/sql-review",};default:const error = ERROR_LIST.find((item) => item.code == code);diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewConfig.vue b/frontend/src/components/SQLReview/SQLReviewConfig.vuesimilarity index 87%rename from frontend/src/components/DatabaseSchemaReview/SchemaReviewConfig.vuerename to frontend/src/components/SQLReview/SQLReviewConfig.vueindex ee6fab1060..7fe52e01af 100644--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewConfig.vue+++ b/frontend/src/components/SQLReview/SQLReviewConfig.vue@@ -1,15 +1,15 @@<template><div class="flex gap-x-20">- <SchemaReviewSidebar :selected-rule-list="selectedRuleList" />+ <SQLReviewSidebar :selected-rule-list="selectedRuleList" /><div class="flex-1">- <SchemaReviewTemplates- :required="true"+ <SQLReviewTemplatesv-if="selectedRuleList.length === 0"+ :required="true":template-list="templateList"- :title="$t('schema-review-policy.create.basic-info.choose-template')"+ :title="$t('sql-review.create.basic-info.choose-template')"@select="(index) => onTemplateApply(index)"/>- <div class="mb-5" v-if="selectedRuleList.length > 0">+ <div v-if="selectedRuleList.length > 0" class="mb-5"><divclass="flex cursor-pointer items-center px-2 text-indigo-500"@click="state.openTemplate = !state.openTemplate"@@ -19,18 +19,16 @@:class="state.openTemplate ? 'rotate-90' : ''"/><span class="ml-1 text-sm font-medium">- {{- $t("schema-review-policy.create.configure-rule.change-template")- }}+ {{ $t("sql-review.create.configure-rule.change-template") }}</span></div>- <SchemaReviewTemplates+ <SQLReviewTemplatesv-if="state.openTemplate":required="false":template-list="templateList":selected-template-index="selectedTemplateIndex"- @select="(index) => onTemplateApply(index)"class="mx-8 mt-5"+ @select="(index) => onTemplateApply(index)"/></div><div@@ -38,7 +36,7 @@><ul role="list" class="divide-y divide-gray-200"><li v-for="rule in selectedRuleList" :key="rule.type">- <SchemaRuleConfig+ <SQLRuleConfig:selected-rule="rule":active="rule.type === state.activeRuleType"@activate="onRuleActivate"@@ -59,8 +57,8 @@ import {RuleLevel,RuleTemplate,RuleConfigComponent,- SchemaReviewPolicyTemplate,-} from "@/types/schemaSystem";+ SQLReviewPolicyTemplate,+} from "@/types/sqlReview";interface LocalState {activeRuleType: RuleType | null;@@ -74,7 +72,7 @@ const props = defineProps({},templateList: {required: true,- type: Object as PropType<SchemaReviewPolicyTemplate[]>,+ type: Object as PropType<SQLReviewPolicyTemplate[]>,},selectedTemplateIndex: {required: true,diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vue b/frontend/src/components/SQLReview/SQLReviewCreation.vuesimilarity index 85%rename from frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vuerename to frontend/src/components/SQLReview/SQLReviewCreation.vueindex 380d30a43e..e7892b45a1 100644--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vue+++ b/frontend/src/components/SQLReview/SQLReviewCreation.vue@@ -10,21 +10,21 @@@cancel="onCancel"><template #0>- <SchemaReviewInfo+ <SQLReviewInfo:name="state.name":selected-environment="state.selectedEnvironment":available-environment-list="availableEnvironmentList":template-list="TEMPLATE_LIST":selected-template-index="state.templateIndex":is-edit="!!policyId"+ class="py-5"@select-template="tryApplyTemplate"@name-change="(val) => (state.name = val)"@env-change="(env) => onEnvChange(env)"- class="py-5"/></template><template #1>- <SchemaReviewConfig+ <SQLReviewConfigclass="py-5":selected-rule-list="state.selectedRuleList":template-list="TEMPLATE_LIST"@@ -34,7 +34,7 @@/></template><template #2>- <SchemaReviewPreview+ <SQLReviewPreview:name="state.name":is-preview-step="true":selected-rule-list="state.selectedRuleList"@@ -47,13 +47,9 @@v-if="state.showAlertModal"style="CRITICAL":ok-text="$t('common.confirm')"- :title="- $t('schema-review-policy.create.configure-rule.confirm-override-title')- "+ :title="$t('sql-review.create.configure-rule.confirm-override-title')":description="- $t(- 'schema-review-policy.create.configure-rule.confirm-override-description'- )+ $t('sql-review.create.configure-rule.confirm-override-description')"@ok="() => {@@ -67,7 +63,7 @@</BBAlert><FeatureModalv-if="state.showFeatureModal"- feature="bb.feature.schema-review-policy"+ feature="bb.feature.sql-review"@cancel="state.showFeatureModal = false"/></div>@@ -89,7 +85,7 @@ import {useCurrentUser,pushNotification,useEnvironmentList,- useSchemaSystemStore,+ useSQLReviewStore,} from "@/store";import { isOwner, isDBA } from "@/utils";@@ -124,34 +120,30 @@ const emit = defineEmits(["cancel"]);const { t } = useI18n();const router = useRouter();-const store = useSchemaSystemStore();+const store = useSQLReviewStore();const currentUser = useCurrentUser();const hasPermission = computed(() => {return isOwner(currentUser.value.role) || isDBA(currentUser.value.role);});-const hasSchemaReviewPolicyFeature = featureToRef(- "bb.feature.schema-review-policy"-);+const hasSQLReviewPolicyFeature = featureToRef("bb.feature.sql-review");const BASIC_INFO_STEP = 0;const CONFIGURE_RULE_STEP = 1;const PREVIEW_STEP = 2;-const ROUTE_NAME = "setting.workspace.schema-review-policy";+const ROUTE_NAME = "setting.workspace.sql-review";const DEFAULT_TEMPLATE_INDEX = 0;const STEP_LIST: BBStepTabItem[] = [- { title: t("schema-review-policy.create.basic-info.name") },- { title: t("schema-review-policy.create.configure-rule.name") },- { title: t("schema-review-policy.create.preview.name") },+ { title: t("sql-review.create.basic-info.name") },+ { title: t("sql-review.create.configure-rule.name") },+ { title: t("sql-review.create.preview.name") },];const state = reactive<LocalState>({currentStep: BASIC_INFO_STEP,- name:- props.name ||- t("schema-review-policy.create.basic-info.display-name-default"),+ name: props.name || t("sql-review.create.basic-info.display-name-default"),selectedEnvironment: props.selectedEnvironment,selectedRuleList: props.selectedRuleList.length? [...props.selectedRuleList]@@ -210,7 +202,7 @@ const tryChangeStep = (};const tryFinishSetup = (allowChangeCallback: () => void) => {- if (!hasSchemaReviewPolicyFeature.value) {+ if (!hasSQLReviewPolicyFeature.value) {state.showFeatureModal = true;return;}@@ -218,7 +210,7 @@ const tryFinishSetup = (allowChangeCallback: () => void) => {pushNotification({module: "bytebase",style: "CRITICAL",- title: t("schema-review-policy.no-permission"),+ title: t("sql-review.no-permission"),});}const upsert = {@@ -243,9 +235,7 @@ const tryFinishSetup = (allowChangeCallback: () => void) => {pushNotification({module: "bytebase",style: "SUCCESS",- title: t(- `schema-review-policy.policy-${props.policyId ? "updated" : "created"}`- ),+ title: t(`sql-review.policy-${props.policyId ? "updated" : "created"}`),});allowChangeCallback();diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewEmptyView.vue b/frontend/src/components/SQLReview/SQLReviewEmptyView.vuesimilarity index 88%rename from frontend/src/components/DatabaseSchemaReview/SchemaReviewEmptyView.vuerename to frontend/src/components/SQLReview/SQLReviewEmptyView.vueindex 45a333b92a..6a7a4bc778 100644--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewEmptyView.vue+++ b/frontend/src/components/SQLReview/SQLReviewEmptyView.vue@@ -6,7 +6,7 @@<div class="text-center flex flex-col justify-center items-center"><img src="../../assets/illustration/no-data.webp" class="w-52" /><h3 class="mt-2 font-medium text-gray-900">- {{ $t("schema-review-policy.no-policy-set") }}+ {{ $t("sql-review.no-policy-set") }}</h3><div class="mt-6"><button@@ -14,7 +14,7 @@class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"@click="$emit('create')">- {{ $t("schema-review-policy.create-policy") }}+ {{ $t("sql-review.create-policy") }}</button></div></div>diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewInfo.vue b/frontend/src/components/SQLReview/SQLReviewInfo.vuesimilarity index 80%rename from frontend/src/components/DatabaseSchemaReview/SchemaReviewInfo.vuerename to frontend/src/components/SQLReview/SQLReviewInfo.vueindex 7da9a0104b..14f5530d78 100644--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewInfo.vue+++ b/frontend/src/components/SQLReview/SQLReviewInfo.vue@@ -2,16 +2,16 @@<div class="space-y-9"><div><label class="textlabel">- {{ $t("schema-review-policy.create.basic-info.display-name") }}+ {{ $t("sql-review.create.basic-info.display-name") }}<span style="color: red">*</span></label><p class="mt-1 textinfolabel">- {{ $t("schema-review-policy.create.basic-info.display-name-label") }}+ {{ $t("sql-review.create.basic-info.display-name-label") }}</p><BBTextFieldclass="mt-2 w-full":placeholder="- $t('schema-review-policy.create.basic-info.display-name-placeholder')+ $t('sql-review.create.basic-info.display-name-placeholder')":value="name"@input="(e) => onNameChange(e)"@@ -19,20 +19,18 @@</div><div><label class="textlabel">- {{ $t("schema-review-policy.create.basic-info.environments") }}+ {{ $t("sql-review.create.basic-info.environments") }}<span style="color: red">*</span></label><p class="mt-1 textinfolabel mb-5">- {{ $t("schema-review-policy.create.basic-info.environments-label") }}+ {{ $t("sql-review.create.basic-info.environments-label") }}</p><BBAttentionv-if="availableEnvironmentList.length === 0":style="'WARN'":title="$t('common.environment')":description="- $t(- 'schema-review-policy.create.basic-info.no-available-environment-desc'- )+ $t('sql-review.create.basic-info.no-available-environment-desc')"class="mb-5"/>@@ -82,12 +80,10 @@:class="state.openTemplate ? 'rotate-90' : ''"/><span class="ml-l text-sm font-medium">- {{- $t("schema-review-policy.create.configure-rule.change-template")- }}+ {{ $t("sql-review.create.configure-rule.change-template") }}</span></div>- <SchemaReviewTemplates+ <SQLReviewTemplatesv-if="state.openTemplate":required="false":template-list="templateList"@@ -96,12 +92,12 @@class="mx-5 mt-5"/></div>- <SchemaReviewTemplates+ <SQLReviewTemplatesv-else:required="true":template-list="templateList":selected-template-index="selectedTemplateIndex"- :title="$t('schema-review-policy.create.basic-info.choose-template')"+ :title="$t('sql-review.create.basic-info.choose-template')"@select="(index) => $emit('select-template', index)"/></div>@@ -110,8 +106,8 @@<script lang="ts" setup>import { PropType, reactive, computed } from "vue";-import { useSchemaSystemStore, useEnvironmentList } from "@/store";-import { Environment, SchemaReviewPolicyTemplate } from "@/types";+import { useSQLReviewStore, useEnvironmentList } from "@/store";+import { Environment, SQLReviewPolicyTemplate } from "@/types";import { environmentName } from "@/utils";interface LocalEnvironment extends Environment {@@ -139,7 +135,7 @@ const props = defineProps({},templateList: {required: true,- type: Object as PropType<SchemaReviewPolicyTemplate[]>,+ type: Object as PropType<SQLReviewPolicyTemplate[]>,},selectedTemplateIndex: {required: true,@@ -157,7 +153,7 @@ const state = reactive<LocalState>({openTemplate: false,});-const store = useSchemaSystemStore();+const store = useSQLReviewStore();const environmentList = computed((): LocalEnvironment[] => {const environmentList = useEnvironmentList(["NORMAL"]);diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vue b/frontend/src/components/SQLReview/SQLReviewPreview.vuesimilarity index 93%rename from frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vuerename to frontend/src/components/SQLReview/SQLReviewPreview.vueindex cb3bab1bc5..a76ec1852d 100644--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vue+++ b/frontend/src/components/SQLReview/SQLReviewPreview.vue@@ -1,8 +1,8 @@<template><div class="flex gap-x-20">- <SchemaReviewSidebar :selected-rule-list="selectedRuleList" />+ <SQLReviewSidebar :selected-rule-list="selectedRuleList" /><div class="flex-1">- <div class="mb-5" v-if="name">+ <div v-if="name" class="mb-5"><h1 class="text-left text-3xl font-bold mb-2">{{ name }}</h1>@@ -18,14 +18,12 @@v-else-if="isPreviewStep"class="my-5":style="`WARN`"- :title="- $t('schema-review-policy.create.basic-info.no-linked-environments')- "+ :title="$t('sql-review.create.basic-info.no-linked-environments')"/><div v-for="category in categoryList" :key="category.id" class="pb-4"><a- :href="`#${category.id.replace(/\./g, '-')}`":id="category.id.replace(/\./g, '-')"+ :href="`#${category.id.replace(/\./g, '-')}`"class="text-left text-2xl text-indigo-600 font-semibold hover:underline">{{ $t(`sql-review.category.${category.id.toLowerCase()}`) }}@@ -33,14 +31,14 @@<div v-for="rule in category.ruleList" :key="rule.type" class="py-4"><div class="sm:flex sm:items-center sm:space-x-4"><a- :href="`#${rule.type.replace(/\./g, '-')}`":id="rule.type.replace(/\./g, '-')"+ :href="`#${rule.type.replace(/\./g, '-')}`"class="text-left text-xl hover:underline whitespace-nowrap">{{ getRuleLocalization(rule.type).title }}</a><div class="mt-3 flex items-center space-x-2 sm:mt-0">- <SchemaRuleLevelBadge :level="rule.level" />+ <SQLRuleLevelBadge :level="rule.level" /><BBBadge:text="$t(`sql-review.engine.${rule.engine.toLowerCase()}`)":can-remove="false"diff --git a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewCard.vue b/frontend/src/components/SQLReview/components/SQLReviewCard.vuesimilarity index 88%rename from frontend/src/components/DatabaseSchemaReview/components/SchemaReviewCard.vuerename to frontend/src/components/SQLReview/components/SQLReviewCard.vueindex e0e66d026b..6707114dd8 100644--- a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewCard.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewCard.vue@@ -9,7 +9,7 @@</h3><BBBadgev-if="reviewPolicy.rowStatus == 'ARCHIVED'"- :text="$t('schema-review-policy.disabled')"+ :text="$t('sql-review.disabled')":can-remove="false":style="'DISABLED'"/>@@ -36,12 +36,8 @@>{{ environmentName(reviewPolicy.environment) }}</router-link>- <span class="text-yellow-700" v-else>- {{- $t(- "schema-review-policy.create.basic-info.no-linked-environments"- )- }}+ <span v-else class="text-yellow-700">+ {{ $t("sql-review.create.basic-info.no-linked-environments") }}</span></dd></div>@@ -77,14 +73,14 @@<script lang="ts" setup>import { PropType } from "vue";import { useRouter } from "vue-router";-import { DatabaseSchemaReviewPolicy } from "@/types/schemaSystem";+import { SQLReviewPolicy } from "@/types/sqlReview";import { useEnvironmentStore } from "@/store";import { environmentName } from "@/utils";const props = defineProps({reviewPolicy: {required: true,- type: Object as PropType<DatabaseSchemaReviewPolicy>,+ type: Object as PropType<SQLReviewPolicy>,},});const emit = defineEmits(["click"]);diff --git a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewCategoryTabFilter.vue b/frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vuesimilarity index 96%rename from frontend/src/components/DatabaseSchemaReview/components/SchemaReviewCategoryTabFilter.vuerename to frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vueindex 3c2ccd3b8f..21b8ae5bac 100644--- a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewCategoryTabFilter.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vue@@ -15,7 +15,7 @@import { computed, reactive, PropType, watch } from "vue";import { BBTabFilterItem } from "@/bbkit/types";import { useI18n } from "vue-i18n";-import { CategoryType } from "@/types/schemaSystem";+import { CategoryType } from "@/types/sqlReview";export interface CategoryFilterItem {id: CategoryType;diff --git a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewSidebar.vue b/frontend/src/components/SQLReview/components/SQLReviewSidebar.vuesimilarity index 96%rename from frontend/src/components/DatabaseSchemaReview/components/SchemaReviewSidebar.vuerename to frontend/src/components/SQLReview/components/SQLReviewSidebar.vueindex 78f4f24ace..0f784ab5d3 100644--- a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewSidebar.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewSidebar.vue@@ -2,7 +2,7 @@<aside class="hidden lg:block"><div class="space-y-6"><h1 class="text-left text-2xl font-semibold">- {{ $t("schema-review-policy.rules") }}+ {{ $t("sql-review.rules") }}</h1><fieldset v-for="(category, index) in categoryList" :key="index"><div class="block text-sm font-medium text-gray-900">diff --git a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewTemplates.vue b/frontend/src/components/SQLReview/components/SQLReviewTemplates.vuesimilarity index 90%rename from frontend/src/components/DatabaseSchemaReview/components/SchemaReviewTemplates.vuerename to frontend/src/components/SQLReview/components/SQLReviewTemplates.vueindex eeefc3efe6..fc5282e36a 100644--- a/frontend/src/components/DatabaseSchemaReview/components/SchemaReviewTemplates.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewTemplates.vue@@ -1,6 +1,6 @@<template><div>- <p class="textlabel" v-if="title">+ <p v-if="title" class="textlabel">{{ title }}<span v-if="required" style="color: red">*</span></p>@@ -33,12 +33,12 @@<script lang="ts" setup>import { PropType } from "vue";-import { SchemaReviewPolicyTemplate } from "@/types/schemaSystem";+import { SQLReviewPolicyTemplate } from "@/types/sqlReview";const props = defineProps({templateList: {required: true,- type: Object as PropType<SchemaReviewPolicyTemplate[]>,+ type: Object as PropType<SQLReviewPolicyTemplate[]>,},selectedTemplateIndex: {required: false,diff --git a/frontend/src/components/DatabaseSchemaReview/components/SchemaRuleConfig.vue b/frontend/src/components/SQLReview/components/SQLRuleConfig.vuesimilarity index 97%rename from frontend/src/components/DatabaseSchemaReview/components/SchemaRuleConfig.vuerename to frontend/src/components/SQLReview/components/SQLRuleConfig.vueindex 8a199ef3f7..1e967dca38 100644--- a/frontend/src/components/DatabaseSchemaReview/components/SchemaRuleConfig.vue+++ b/frontend/src/components/SQLReview/components/SQLRuleConfig.vue@@ -18,7 +18,7 @@:text="$t(`sql-review.engine.${selectedRule.engine.toLowerCase()}`)":can-remove="false"/>- <SchemaRuleLevelBadge :level="selectedRule.level" />+ <SQLRuleLevelBadge :level="selectedRule.level" /></div><div class="text-sm text-gray-400 ml-7">{{ getRuleLocalization(selectedRule.type).description }}@@ -39,8 +39,8 @@:value="level"type="radio":checked="level === selectedRule.level"- @input="emit('level-change', level)"class="text-accent disabled:text-accent-disabled focus:ring-accent"+ @input="emit('level-change', level)"/><label:for="`level-${level}`"@@ -97,7 +97,7 @@type="text"pattern="[a-z]+"class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full border-gray-300 rounded-md"- :placeholder="$t('schema-review-policy.input-then-press-enter')"+ :placeholder="$t('sql-review.input-then-press-enter')"@keyup.enter="(e) => pushToList(index, e)"/></div>@@ -130,7 +130,7 @@ import {RuleConfigComponent,getRuleLocalization,getRuleLocalizationKey,-} from "@/types/schemaSystem";+} from "@/types/sqlReview";type PayloadValueList = (string | number | string[])[];interface LocalState {diff --git a/frontend/src/components/DatabaseSchemaReview/components/SchemaRuleLevelBadge.vue b/frontend/src/components/SQLReview/components/SQLRuleLevelBadge.vuesimilarity index 92%rename from frontend/src/components/DatabaseSchemaReview/components/SchemaRuleLevelBadge.vuerename to frontend/src/components/SQLReview/components/SQLRuleLevelBadge.vueindex 7528f37d25..39c38b2492 100644--- a/frontend/src/components/DatabaseSchemaReview/components/SchemaRuleLevelBadge.vue+++ b/frontend/src/components/SQLReview/components/SQLRuleLevelBadge.vue@@ -8,7 +8,7 @@<script lang="ts" setup>import { PropType, computed } from "vue";-import { RuleLevel } from "@/types/schemaSystem";+import { RuleLevel } from "@/types/sqlReview";import { BBBadgeStyle } from "@/bbkit/BBBadge.vue";const props = defineProps({diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex e2274e9f9f..c3ecce574a 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1293,7 +1293,7 @@"title": "Backup policy","desc": "Backup policy will auto-backup your database based on the schedule."},- "bb-feature-schema-review-policy": {+ "bb-feature-sql-review": {"title": "Schema review policy","desc": "Customize the schema review policy for different environments. @:{'subscription.trial'}."},@@ -1348,7 +1348,7 @@"sql-check-basic": "Basic","sql-check-basic-tooltip": "Syntax check, connection check","sql-check-advanced": "Advanced",- "sql-check-advanced-tooltip": "Basic + Customized schema review rules",+ "sql-check-advanced-tooltip": "Basic + Customized SQL review rules","anomaly-detection": "Anomaly detection","anomaly-detection-basic": "Basic","anomaly-detection-basic-tooltip": "Connection failure, missing backup",@@ -1423,10 +1423,10 @@"mysql": "MySQL","common": "Common"},- "schema-review-policy": {- "title": "Schema Review",+ "sql-review": {+ "title": "SQL Review","disabled": "Disabled",- "no-policy-set": "No schema review policy",+ "no-policy-set": "No SQL review policy","create-policy": "Create policy","configure-policy": "Configure policy","search-rule-name": "Search rule name",@@ -1438,15 +1438,15 @@"no-permission": "Only DBA or Owner has permission to create or update review policy.","disable": "Disable","enable": "Enable",- "delete": "Delete schema review policy",+ "delete": "Delete SQL review policy","input-then-press-enter": "Input the value then press enter to add","create": {- "breadcrumb": "Create schema review policy",+ "breadcrumb": "Create SQL review policy","basic-info": {"name": "Basic info","display-name": "Display name","display-name-placeholder": "The review policy name",- "display-name-default": "Schema review policy",+ "display-name-default": "SQL review policy","display-name-label": "A display name to help identifying among different review policies.","environments": "Environments","environments-label": "Apply the review policy to the selected environments. One environment can only link one policy.",diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.jsonindex 85727e5881..6675c50bc4 100644--- a/frontend/src/locales/sql-review/en-US.json+++ b/frontend/src/locales/sql-review/en-US.json@@ -12,8 +12,8 @@"schema": "Schema"},"template": {- "mysql-prod": "Production Environment Template",- "mysql-dev": "Development Environment Template"+ "mysql-prod": "Template for Prod Environment",+ "mysql-dev": "Template for Dev Environment"},"rule": {"engine-mysql-use-innodb": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 4d79e3bf4a..7ed4c3e523 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1294,7 +1294,7 @@"title": "备份策略","desc": "「备份策略」可以根据指定的周期自动备份数据库"},- "bb-feature-schema-review-policy": {+ "bb-feature-sql-review": {"title": "Schema 审核策略","desc": "给不同的环境定制 schema 审核策略,可以通过@:{'subscription.upgrade'}来开启该功能。"},@@ -1349,7 +1349,7 @@"sql-check-basic": "基础","sql-check-basic-tooltip": "语法检查、数据库连接检查","sql-check-advanced": "高级",- "sql-check-advanced-tooltip": "基础版功能 + 自定义 schema 审核规则",+ "sql-check-advanced-tooltip": "基础版功能 + 自定义 SQL 审核规则","anomaly-detection": "异常检测","anomaly-detection-basic": "基础","anomaly-detection-basic-tooltip": "数据库连接异常、备份缺失",@@ -1424,10 +1424,10 @@"mysql": "MySQL","common": "通用"},- "schema-review-policy": {- "title": "Schema 审核策略",+ "sql-review": {+ "title": "SQL 审核策略","disabled": "已禁用",- "no-policy-set": "没有 schema 审核策略",+ "no-policy-set": "没有 SQL 审核策略","create-policy": "创建审核策略","configure-policy": "配置审核策略","search-rule-name": "搜索规则名称",@@ -1448,7 +1448,7 @@"display-name": "名称","display-name-placeholder": "审核策略名称","display-name-label": "用以区分不同审核策略的名称。",- "display-name-default": "Schema 审核策略",+ "display-name-default": "SQL 审核策略","environments": "环境","environments-label": "将该审核策略应用于哪些环境。一个环境只能关联一个审核策略。","environments-select": "选择环境",diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex 2976a8d10f..9bd99df30c 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -42,7 +42,7 @@ import {useVCSStore,useProjectWebhookStore,useDataSourceStore,- useSchemaSystemStore,+ useSQLReviewStore,useProjectStore,useTableStore,useSQLEditorStore,@@ -393,40 +393,40 @@ const routes: Array<RouteRecordRaw> = [props: true,},{- path: "schema-review-policy",- name: "setting.workspace.schema-review-policy",+ path: "sql-review",+ name: "setting.workspace.sql-review",meta: {- title: () => t("schema-review-policy.title"),+ title: () => t("sql-review.title"),},component: () =>- import("../views/SettingWorkspaceSchemaReview.vue"),+ import("../views/SettingWorkspaceSQLReview.vue"),props: true,},{- path: "schema-review-policy/new",- name: "setting.workspace.schema-review-policy.create",+ path: "sql-review/new",+ name: "setting.workspace.sql-review.create",meta: {- title: () => t("schema-review-policy.create.breadcrumb"),+ title: () => t("sql-review.create.breadcrumb"),},component: () =>- import("../views/SettingWorkspaceSchemaReviewCreate.vue"),+ import("../views/SettingWorkspaceSQLReviewCreate.vue"),props: true,},{- path: "schema-review-policy/:schemaReviewPolicySlug",- name: "setting.workspace.schema-review-policy.detail",+ path: "sql-review/:sqlReviewPolicySlug",+ name: "setting.workspace.sql-review.detail",meta: {title: (route: RouteLocationNormalized) => {- const slug = route.params.schemaReviewPolicySlug as string;+ const slug = route.params.sqlReviewPolicySlug as string;return (- useSchemaSystemStore().getReviewPolicyByEnvironmentId(+ useSQLReviewStore().getReviewPolicyByEnvironmentId(idFromSlug(slug))?.name ?? "");},},component: () =>- import("../views/SettingWorkspaceSchemaReviewDetail.vue"),+ import("../views/SettingWorkspaceSQLReviewDetail.vue"),props: true,},],@@ -1032,7 +1032,7 @@ router.beforeEach((to, from, next) => {to.name?.toString().startsWith("sheets") ||(to.name?.toString().startsWith("setting") &&to.name?.toString() != "setting.workspace.version-control.detail" &&- to.name?.toString() != "setting.workspace.schema-review-policy.detail")+ to.name?.toString() != "setting.workspace.sql-review.detail")) {next();return;@@ -1059,7 +1059,7 @@ router.beforeEach((to, from, next) => {const vcsSlug = routerSlug.vcsSlug;const connectionSlug = routerSlug.connectionSlug;const sheetSlug = routerSlug.sheetSlug;- const schemaReviewPolicySlug = routerSlug.schemaReviewPolicySlug;+ const sqlReviewPolicySlug = routerSlug.sqlReviewPolicySlug;if (principalId) {usePrincipalStore()@@ -1268,9 +1268,9 @@ router.beforeEach((to, from, next) => {return;}- if (schemaReviewPolicySlug) {- useSchemaSystemStore()- .fetchReviewPolicyByEnvironmentId(idFromSlug(schemaReviewPolicySlug))+ if (sqlReviewPolicySlug) {+ useSQLReviewStore()+ .fetchReviewPolicyByEnvironmentId(idFromSlug(sqlReviewPolicySlug)).then(() => {next();})diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.tsindex a67b195de9..3a322ae24a 100644--- a/frontend/src/store/modules/index.ts+++ b/frontend/src/store/modules/index.ts@@ -39,4 +39,4 @@ export * from "./uistate";export * from "./vcs";export * from "./view";export * from "./db_extension";-export * from "./schemaSystem";+export * from "./sqlReview";diff --git a/frontend/src/store/modules/router.ts b/frontend/src/store/modules/router.tsindex 16b8299bda..c512ee82e0 100644--- a/frontend/src/store/modules/router.ts+++ b/frontend/src/store/modules/router.ts@@ -168,14 +168,14 @@ export const useRouterStore = defineStore("router", {}{- // /setting/schema-review-policy/:schemaReviewPolicyId+ // /setting/sql-review/:sqlReviewPolicyId// Total 2 elements, 2nd element is the schema review id- const schemaReviewComponents = currentRoute.path.match(- "/setting/schema-review-policy/([0-9a-zA-Z_-]+)"+ const sqlReviewComponents = currentRoute.path.match(+ "/setting/sql-review/([0-9a-zA-Z_-]+)") || ["/", undefined];- if (schemaReviewComponents[1]) {+ if (sqlReviewComponents[1]) {return {- schemaReviewPolicySlug: schemaReviewComponents[1],+ sqlReviewPolicySlug: sqlReviewComponents[1],};}}diff --git a/frontend/src/store/modules/schemaSystem.ts b/frontend/src/store/modules/sqlReview.tssimilarity index 83%rename from frontend/src/store/modules/schemaSystem.tsrename to frontend/src/store/modules/sqlReview.tsindex 703b6be71c..7f2d7c2881 100644--- a/frontend/src/store/modules/schemaSystem.ts+++ b/frontend/src/store/modules/sqlReview.ts@@ -10,19 +10,19 @@ import {Environment,PolicyUpsert,SchemaPolicyRule,- SchemaReviewPolicyPayload,- DatabaseSchemaReviewPolicy,+ SQLReviewPolicyPayload,+ SQLReviewPolicy,} from "@/types";import { defineStore } from "pinia";import { usePolicyStore } from "./policy";-const convertToSchemaReviewPolicy = (+const convertToSQLReviewPolicy = (policy: Policy-): DatabaseSchemaReviewPolicy | undefined => {+): SQLReviewPolicy | undefined => {if (policy.type !== "bb.policy.schema-review") {return;}- const payload = policy.payload as SchemaReviewPolicyPayload;+ const payload = policy.payload as SQLReviewPolicyPayload;if (!Array.isArray(payload.ruleList) || !payload.name) {return;}@@ -51,16 +51,16 @@ const convertToSchemaReviewPolicy = (};};-interface SchemaSystemState {- reviewPolicyList: DatabaseSchemaReviewPolicy[];+interface SQLReviewState {+ reviewPolicyList: SQLReviewPolicy[];}-export const useSchemaSystemStore = defineStore("schemaSystem", {- state: (): SchemaSystemState => ({+export const useSQLReviewStore = defineStore("sqlReview", {+ state: (): SQLReviewState => ({reviewPolicyList: [],}),actions: {- setReviewPolicy(reviewPolicy: DatabaseSchemaReviewPolicy) {+ setReviewPolicy(reviewPolicy: SQLReviewPolicy) {const index = this.reviewPolicyList.findIndex((r) => r.id === reviewPolicy.id);@@ -109,7 +109,7 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {environmentId: number;ruleList: SchemaPolicyRule[];}) {- const payload: SchemaReviewPolicyPayload = {+ const payload: SQLReviewPolicyPayload = {name,ruleList: ruleList.map((r) => ({...r,@@ -124,7 +124,7 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {policyUpsert: { payload },});- const reviewPolicy = convertToSchemaReviewPolicy(policy);+ const reviewPolicy = convertToSQLReviewPolicy(policy);if (!reviewPolicy) {throw new Error(`invalid policy ${JSON.stringify(policy)}`);}@@ -169,7 +169,7 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {policyUpsert.rowStatus = rowStatus;}if (name && ruleList) {- const payload: SchemaReviewPolicyPayload = {+ const payload: SQLReviewPolicyPayload = {name,ruleList: ruleList.map((r) => ({...r,@@ -186,7 +186,7 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {policyUpsert,});- const reviewPolicy = convertToSchemaReviewPolicy(policy);+ const reviewPolicy = convertToSQLReviewPolicy(policy);this.reviewPolicyList = [...this.reviewPolicyList.slice(0, index),{@@ -198,9 +198,9 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {},getReviewPolicyByEnvironmentId(environmentId: EnvironmentId- ): DatabaseSchemaReviewPolicy | undefined {+ ): SQLReviewPolicy | undefined {if (environmentId === EMPTY_ID) {- return empty("SCHEMA_REVIEW") as DatabaseSchemaReviewPolicy;+ return empty("SQL_REVIEW") as SQLReviewPolicy;}return this.reviewPolicyList.find(@@ -208,25 +208,25 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {);},- async fetchReviewPolicyList(): Promise<DatabaseSchemaReviewPolicy[]> {+ async fetchReviewPolicyList(): Promise<SQLReviewPolicy[]> {const policyStore = usePolicyStore();const policyList = await policyStore.fetchPolicyListByType("bb.policy.schema-review");const reviewPolicyList = policyList.reduce((list, policy) => {- const reviewPolicy = convertToSchemaReviewPolicy(policy);+ const reviewPolicy = convertToSQLReviewPolicy(policy);if (reviewPolicy) {list.push(reviewPolicy);}return list;- }, [] as DatabaseSchemaReviewPolicy[]);+ }, [] as SQLReviewPolicy[]);this.reviewPolicyList = reviewPolicyList;return reviewPolicyList;},async fetchReviewPolicyByEnvironmentId(environmentId: EnvironmentId- ): Promise<DatabaseSchemaReviewPolicy | undefined> {+ ): Promise<SQLReviewPolicy | undefined> {const policyStore = usePolicyStore();const policy = await policyStore.fetchPolicyByEnvironmentAndType({environmentId: environmentId,@@ -236,7 +236,7 @@ export const useSchemaSystemStore = defineStore("schemaSystem", {if (!policy) {return;}- const reviewPolicy = convertToSchemaReviewPolicy(policy);+ const reviewPolicy = convertToSQLReviewPolicy(policy);if (reviewPolicy) {this.setReviewPolicy(reviewPolicy);}diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.tsindex c2bac34f95..f1251af8fc 100644--- a/frontend/src/types/common.ts+++ b/frontend/src/types/common.ts@@ -24,7 +24,7 @@ import { VCS } from "./vcs";import { DeploymentConfig } from "./deployment";import { DefaultApporvalPolicy } from "./policy";import { Sheet } from "./sheet";-import { DatabaseSchemaReviewPolicy } from "./schemaSystem";+import { SQLReviewPolicy } from "./sqlReview";// System bot idexport const SYSTEM_BOT_ID = 1;@@ -73,7 +73,7 @@ export type RouterSlug = {vcsSlug?: string;connectionSlug?: string;sheetSlug?: string;- schemaReviewPolicySlug?: string;+ sqlReviewPolicySlug?: string;};// Quick Action Type@@ -137,7 +137,7 @@ export type ResourceType =| "ANOMALY"| "DEPLOYMENT_CONFIG"| "SHEET"- | "SCHEMA_REVIEW";+ | "SQL_REVIEW";interface ResourceMaker {(type: "PRINCIPAL"): Principal;@@ -163,7 +163,7 @@ interface ResourceMaker {(type: "ANOMALY"): Anomaly;(type: "DEPLOYMENT_CONFIG"): DeploymentConfig;(type: "SHEET"): Sheet;- (type: "SCHEMA_REVIEW"): DatabaseSchemaReviewPolicy;+ (type: "SQL_REVIEW"): SQLReviewPolicy;}const makeUnknown = (type: ResourceType) => {@@ -495,7 +495,7 @@ const makeUnknown = (type: ResourceType) => {pinned: false,};- const UNKNOWN_SCHEMA_REVIEW_POLICY: DatabaseSchemaReviewPolicy = {+ const UNKNOWN_SQL_REVIEW_POLICY: SQLReviewPolicy = {id: UNKNOWN_ID,creator: UNKNOWN_PRINCIPAL,updater: UNKNOWN_PRINCIPAL,@@ -554,8 +554,8 @@ const makeUnknown = (type: ResourceType) => {return UNKNOWN_DEPLOYMENT_CONFIG;case "SHEET":return UNKNOWN_SHEET;- case "SCHEMA_REVIEW":- return UNKNOWN_SCHEMA_REVIEW_POLICY;+ case "SQL_REVIEW":+ return UNKNOWN_SQL_REVIEW_POLICY;}};export const unknown = makeUnknown as ResourceMaker;@@ -887,7 +887,7 @@ const makeEmpty = (type: ResourceType) => {pinned: false,};- const EMPTY_SCHEMA_REVIEW_POLICY: DatabaseSchemaReviewPolicy = {+ const EMPTY_SQL_REVIEW_POLICY: SQLReviewPolicy = {id: EMPTY_ID,creator: EMPTY_PRINCIPAL,updater: EMPTY_PRINCIPAL,@@ -946,8 +946,8 @@ const makeEmpty = (type: ResourceType) => {return EMPTY_DEPLOYMENT_CONFIG;case "SHEET":return EMPTY_SHEET;- case "SCHEMA_REVIEW":- return EMPTY_SCHEMA_REVIEW_POLICY;+ case "SQL_REVIEW":+ return EMPTY_SQL_REVIEW_POLICY;}};export const empty = makeEmpty as ResourceMaker;diff --git a/frontend/src/types/error.ts b/frontend/src/types/error.tsindex 74034427ee..d60c0d55ff 100644--- a/frontend/src/types/error.ts+++ b/frontend/src/types/error.ts@@ -21,7 +21,7 @@ export enum MigrationErrorCode {MIGRATION_BASELINE_MISSING = 204,}-export enum SchemaReviewPolicyErrorCode {+export enum SQLReviewPolicyErrorCode {EMPTY_POLICY = 401,STATEMENT_NO_WHERE = 10101,STATEMENT_NO_SELECT_ALL = 10102,@@ -56,7 +56,7 @@ export type ErrorCode =| DBErrorCode| MigrationErrorCode| CompatibilityErrorCode- | SchemaReviewPolicyErrorCode;+ | SQLReviewPolicyErrorCode;export type ErrorTag = "General" | "Compatibility";diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.tsindex c6464e1d26..27d9e7a1e0 100644--- a/frontend/src/types/index.ts+++ b/frontend/src/types/index.ts@@ -41,4 +41,4 @@ export * from "./tab";export * from "./subscription";export * from "./sheet";export * from "./sheetOrganizer";-export * from "./schemaSystem";+export * from "./sqlReview";diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.tsindex cdddac739a..3119ab3004 100644--- a/frontend/src/types/plan.ts+++ b/frontend/src/types/plan.ts@@ -3,7 +3,7 @@ export type FeatureType =// Database management| "bb.feature.disaster-recovery-pitr"// Change Workflow- | "bb.feature.schema-review-policy"+ | "bb.feature.sql-review"| "bb.feature.schema-drift"| "bb.feature.task-schedule-time"| "bb.feature.multi-tenancy"@@ -51,7 +51,7 @@ export const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([// Database management["bb.feature.disaster-recovery-pitr", [false, true, true]],// Change Workflow- ["bb.feature.schema-review-policy", [false, true, true]],+ ["bb.feature.sql-review", [false, true, true]],["bb.feature.schema-drift", [false, true, true]],["bb.feature.task-schedule-time", [false, true, true]],["bb.feature.multi-tenancy", [false, true, true]],diff --git a/frontend/src/types/policy.ts b/frontend/src/types/policy.tsindex f63112b270..e6b4213b99 100644--- a/frontend/src/types/policy.ts+++ b/frontend/src/types/policy.ts@@ -31,8 +31,8 @@ export type BackupPlanPolicyPayload = {export const DefaultSchedulePolicy: BackupPlanPolicySchedule = "UNSET";-// SchemaReviewPolicyPayload is the payload for schema review policy in the backend.-export type SchemaReviewPolicyPayload = {+// SQLReviewPolicyPayload is the payload for schema review policy in the backend.+export type SQLReviewPolicyPayload = {name: string;ruleList: {type: RuleType;@@ -44,7 +44,7 @@ export type SchemaReviewPolicyPayload = {export type PolicyPayload =| PipelineApporvalPolicyPayload| BackupPlanPolicyPayload- | SchemaReviewPolicyPayload;+ | SQLReviewPolicyPayload;export type Policy = {id: PolicyId;diff --git a/frontend/src/types/setting.ts b/frontend/src/types/setting.tsindex 56cd44e564..393c5f4573 100644--- a/frontend/src/types/setting.ts+++ b/frontend/src/types/setting.ts@@ -18,4 +18,4 @@ export type Setting = {description: string;};-export const brandingLogoSettingName: SettingName = "bb.branding.logo";\ No newline at end of file+export const brandingLogoSettingName: SettingName = "bb.branding.logo";diff --git a/frontend/src/types/schemaSystem.ts b/frontend/src/types/sqlReview.tssimilarity index 96%rename from frontend/src/types/schemaSystem.tsrename to frontend/src/types/sqlReview.tsindex 3cce0c7031..2ba1c08692 100644--- a/frontend/src/types/schemaSystem.ts+++ b/frontend/src/types/sqlReview.ts@@ -3,7 +3,7 @@ import { PolicyId } from "./id";import { Principal } from "./principal";import { RowStatus } from "./common";import { Environment } from "./environment";-import schemaSystemConfig from "./sqlReviewConfig.yaml";+import sqlReviewConfig from "./sqlReviewConfig.yaml";// The engine type for rule templateexport type SchemaRuleEngineType = "MYSQL" | "COMMON";@@ -108,8 +108,8 @@ export interface SchemaPolicyRule {payload?: NamingFormatPayload | RequiredColumnPayload;}-// The API for schema review policy in backend.-export interface DatabaseSchemaReviewPolicy {+// The API for SQL review policy in backend.+export interface SQLReviewPolicy {id: PolicyId;// Standard fields@@ -134,14 +134,14 @@ export interface RuleTemplate {level: RuleLevel;}-// SchemaReviewPolicyTemplate is the rule template set-export interface SchemaReviewPolicyTemplate {+// SQLReviewPolicyTemplate is the rule template set+export interface SQLReviewPolicyTemplate {id: string;ruleList: RuleTemplate[];}export const TEMPLATE_LIST =- schemaSystemConfig.templateList as SchemaReviewPolicyTemplate[];+ sqlReviewConfig.templateList as SQLReviewPolicyTemplate[];export const ruleTemplateMap: Map<RuleType, RuleTemplate> =TEMPLATE_LIST.reduce((map, template) => {@@ -160,7 +160,7 @@ interface RuleCategory {export const convertToCategoryList = (ruleList: RuleTemplate[]): RuleCategory[] => {- const categoryList = schemaSystemConfig.categoryList as CategoryType[];+ const categoryList = sqlReviewConfig.categoryList as CategoryType[];const categoryOrder = categoryList.reduce((map, category, index) => {map.set(category, index);return map;diff --git a/frontend/src/utils/slug.ts b/frontend/src/utils/slug.tsindex 2bb67b719a..e20ccfcd65 100644--- a/frontend/src/utils/slug.ts+++ b/frontend/src/utils/slug.ts@@ -9,7 +9,7 @@ import {Project,ProjectWebhook,VCS,- DatabaseSchemaReviewPolicy,+ SQLReviewPolicy,} from "../types";import { IdType } from "../types/id";@@ -79,9 +79,7 @@ export function vcsSlug(vcs: VCS): string {return [slug(vcs.name), vcs.id].join("-");}-export function schemaReviewPolicySlug(- reviewPolicy: DatabaseSchemaReviewPolicy-): string {+export function sqlReviewPolicySlug(reviewPolicy: SQLReviewPolicy): string {return [slug(reviewPolicy.name), reviewPolicy.environment.id].join("-");}diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vueindex 3390863f6c..9bf42437a1 100644--- a/frontend/src/views/SettingSidebar.vue+++ b/frontend/src/views/SettingSidebar.vue@@ -74,9 +74,9 @@>{{ $t("settings.sidebar.version-control") }}</router-link><router-link- to="/setting/schema-review-policy"+ to="/setting/sql-review"class="outline-item group w-full flex items-center pl-11 pr-2 py-2"- >{{ $t("schema-review-policy.title") }}</router-link+ >{{ $t("sql-review.title") }}</router-link><router-linkto="/setting/subscription"@@ -115,7 +115,7 @@ export default defineComponent({default: "",type: String,},- schemaReviewPolicySlug: {+ sqlReviewPolicySlug: {default: "",type: String,},diff --git a/frontend/src/views/SettingWorkspaceSchemaReview.vue b/frontend/src/views/SettingWorkspaceSQLReview.vuesimilarity index 57%rename from frontend/src/views/SettingWorkspaceSchemaReview.vuerename to frontend/src/views/SettingWorkspaceSQLReview.vueindex 3f4867fc01..4b572e5475 100644--- a/frontend/src/views/SettingWorkspaceSchemaReview.vue+++ b/frontend/src/views/SettingWorkspaceSQLReview.vue@@ -1,29 +1,27 @@<template><div class="mx-auto"><FeatureAttention- v-if="!hasSchemaReviewPolicyFeature"+ v-if="!hasSQLReviewPolicyFeature"custom-class="mt-5"- feature="bb.feature.schema-review-policy"- :description="- $t('subscription.features.bb-feature-schema-review-policy.desc')- "+ feature="bb.feature.sql-review"+ :description="$t('subscription.features.bb-feature-sql-review.desc')"/><div v-if="store.reviewPolicyList.length > 0" class="space-y-6 my-5">- <div class="flex items-center justify-end" v-if="hasPermission">+ <div v-if="hasPermission" class="flex items-center justify-end"><buttontype="button"class="btn-primary ml-3 inline-flex justify-center py-2 px-4"@click.prevent="goToCreationView">- {{ $t("schema-review-policy.create-policy") }}+ {{ $t("sql-review.create-policy") }}</button></div><template v-for="review in store.reviewPolicyList" :key="review.id">- <SchemaReviewCard :review-policy="review" @click="onClick" />+ <SQLReviewCard :review-policy="review" @click="onClick" /></template></div><template v-else>- <SchemaReviewEmptyView @create="goToCreationView" />+ <SQLReviewEmptyView @create="goToCreationView" /></template></div></template>@@ -34,16 +32,16 @@ import { useRouter } from "vue-router";import { useI18n } from "vue-i18n";import {pushNotification,- useSchemaSystemStore,+ useSQLReviewStore,useCurrentUser,featureToRef,} from "@/store";-import { DatabaseSchemaReviewPolicy } from "@/types/schemaSystem";-import { schemaReviewPolicySlug, isDBAOrOwner } from "@/utils";+import { SQLReviewPolicy } from "@/types/sqlReview";+import { sqlReviewPolicySlug, isDBAOrOwner } from "@/utils";const router = useRouter();-const store = useSchemaSystemStore();-const ROUTE_NAME = "setting.workspace.schema-review-policy";+const store = useSQLReviewStore();+const ROUTE_NAME = "setting.workspace.sql-review";const currentUser = useCurrentUser();const { t } = useI18n();@@ -55,9 +53,7 @@ const hasPermission = computed(() => {return isDBAOrOwner(currentUser.value.role);});-const hasSchemaReviewPolicyFeature = featureToRef(- "bb.feature.schema-review-policy"-);+const hasSQLReviewPolicyFeature = featureToRef("bb.feature.sql-review");const goToCreationView = () => {if (hasPermission.value) {@@ -68,16 +64,16 @@ const goToCreationView = () => {pushNotification({module: "bytebase",style: "CRITICAL",- title: t("schema-review-policy.no-permission"),+ title: t("sql-review.no-permission"),});}};-const onClick = (review: DatabaseSchemaReviewPolicy) => {+const onClick = (review: SQLReviewPolicy) => {router.push({name: `${ROUTE_NAME}.detail`,params: {- schemaReviewPolicySlug: schemaReviewPolicySlug(review),+ sqlReviewPolicySlug: sqlReviewPolicySlug(review),},});};diff --git a/frontend/src/views/SettingWorkspaceSchemaReviewCreate.vue b/frontend/src/views/SettingWorkspaceSQLReviewCreate.vuesimilarity index 65%rename from frontend/src/views/SettingWorkspaceSchemaReviewCreate.vuerename to frontend/src/views/SettingWorkspaceSQLReviewCreate.vueindex 5e17f00bcc..662b89b1b9 100644--- a/frontend/src/views/SettingWorkspaceSchemaReviewCreate.vue+++ b/frontend/src/views/SettingWorkspaceSQLReviewCreate.vue@@ -1,14 +1,12 @@<template><div class="my-4 space-y-4 divide-y divide-block-border"><FeatureAttention- v-if="!hasSchemaReviewPolicyFeature"+ v-if="!hasSQLReviewPolicyFeature"custom-class="mb-5"- feature="bb.feature.schema-review-policy"- :description="- $t('subscription.features.bb-feature-schema-review-policy.desc')- "+ feature="bb.feature.sql-review"+ :description="$t('subscription.features.bb-feature-sql-review.desc')"/>- <SchemaReviewCreation+ <SQLReviewCreation:selected-rule-list="[]":selected-environment="environment"/>@@ -17,21 +15,15 @@<script lang="ts" setup>import { computed, watchEffect } from "vue";-import {- useEnvironmentStore,- featureToRef,- useSchemaSystemStore,-} from "@/store";+import { useEnvironmentStore, featureToRef, useSQLReviewStore } from "@/store";import { EMPTY_ID } from "@/types";const url = new URL(window.location.href);const params = new URLSearchParams(url.search);const environmentId = params.get("environmentId") ?? "";-const store = useSchemaSystemStore();+const store = useSQLReviewStore();-const hasSchemaReviewPolicyFeature = featureToRef(- "bb.feature.schema-review-policy"-);+const hasSQLReviewPolicyFeature = featureToRef("bb.feature.sql-review");watchEffect(() => {store.fetchReviewPolicyList();diff --git a/frontend/src/views/SettingWorkspaceSchemaReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vuesimilarity index 88%rename from frontend/src/views/SettingWorkspaceSchemaReviewDetail.vuerename to frontend/src/views/SettingWorkspaceSQLReviewDetail.vueindex f8dfd14881..0685144118 100644--- a/frontend/src/views/SettingWorkspaceSchemaReviewDetail.vue+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue@@ -1,14 +1,12 @@<template><FeatureAttention- v-if="!hasSchemaReviewPolicyFeature"+ v-if="!hasSQLReviewPolicyFeature"custom-class="my-5"- feature="bb.feature.schema-review-policy"- :description="- $t('subscription.features.bb-feature-schema-review-policy.desc')- "+ feature="bb.feature.sql-review"+ :description="$t('subscription.features.bb-feature-sql-review.desc')"/><transition appear name="slide-from-bottom" mode="out-in">- <SchemaReviewCreation+ <SQLReviewCreationv-if="state.editMode":policy-id="reviewPolicy.id":name="reviewPolicy.name"@@ -16,7 +14,7 @@:selected-rule-list="selectedRuleList"@cancel="state.editMode = false"/>- <div class="my-5" v-else>+ <div v-else class="my-5"><divclass="flex flex-col items-center space-x-2 justify-center md:flex-row">@@ -26,7 +24,7 @@</h1><div v-if="reviewPolicy.rowStatus == 'ARCHIVED'"><BBBadge- :text="$t('schema-review-policy.disabled')"+ :text="$t('sql-review.disabled')":can-remove="false":style="'DISABLED'"/>@@ -58,8 +56,8 @@</button></div><div- class="flex items-center flex-wrap gap-x-3 my-5"v-if="reviewPolicy.environment"+ class="flex items-center flex-wrap gap-x-3 my-5"><span class="font-semibold">{{ $t("common.environment") }}</span><router-link@@ -73,14 +71,10 @@v-elseclass="my-5":style="`WARN`"- :title="- $t('schema-review-policy.create.basic-info.no-linked-environments')- "+ :title="$t('sql-review.create.basic-info.no-linked-environments')"/><div class="space-y-2 my-5">- <span class="font-semibold">{{- $t("schema-review-policy.filter")- }}</span>+ <span class="font-semibold">{{ $t("sql-review.filter") }}</span><div class="flex flex-wrap gap-x-3"><span>{{ $t("common.database") }}:</span><div@@ -89,12 +83,12 @@class="flex items-center"><input- type="checkbox":id="engine.id"+ type="checkbox":value="engine.id":checked="state.checkedEngine.has(engine.id)"- @input="toggleCheckedEngine(engine.id)"class="h-4 w-4 border-gray-300 rounded text-indigo-600 focus:ring-indigo-500"+ @input="toggleCheckedEngine(engine.id)"/><label:for="engine.id"@@ -117,12 +111,12 @@class="flex items-center"><input- type="checkbox":id="level.id"+ type="checkbox":value="level.id":checked="state.checkedLevel.has(level.id)"- @input="toggleCheckedLevel(level.id)"class="h-4 w-4 border-gray-300 rounded text-indigo-600 focus:ring-indigo-500"+ @input="toggleCheckedLevel(level.id)"/><label:for="level.id"@@ -139,25 +133,25 @@</div></div><div class="py-2 flex justify-between items-center mt-5">- <SchemaReviewCategoryTabFilter+ <SQLReviewCategoryTabFilter:selected="state.selectedCategory":category-list="categoryFilterList"@select="selectCategory"/><BBTableSearchref="searchField"- :placeholder="$t('schema-review-policy.search-rule-name')"+ :placeholder="$t('sql-review.search-rule-name')"@change-text="(text) => (state.searchText = text)"/></div>- <SchemaReviewPreview+ <SQLReviewPreview:selected-rule-list="filteredSelectedRuleList"class="py-5"/><BBButtonConfirmv-if="reviewPolicy.rowStatus === 'ARCHIVED'":style="'DELETE'"- :button-text="$t('schema-review-policy.delete')"+ :button-text="$t('sql-review.delete')":ok-text="$t('common.delete')":confirm-title="$t('common.delete') + ` '${reviewPolicy.name}'?`":require-confirm="true"@@ -208,7 +202,7 @@ import {LEVEL_LIST,RuleLevel,RuleTemplate,- DatabaseSchemaReviewPolicy,+ SQLReviewPolicy,SchemaRuleEngineType,convertToCategoryList,ruleTemplateMap,@@ -218,12 +212,12 @@ import {featureToRef,useCurrentUser,pushNotification,- useSchemaSystemStore,+ useSQLReviewStore,} from "@/store";-import { CategoryFilterItem } from "../components/DatabaseSchemaReview/components/SchemaReviewCategoryTabFilter.vue";+import { CategoryFilterItem } from "../components/SQLReview/components/SQLReviewCategoryTabFilter.vue";const props = defineProps({- schemaReviewPolicySlug: {+ sqlReviewPolicySlug: {required: true,type: String,},@@ -240,10 +234,10 @@ interface LocalState {}const { t } = useI18n();-const store = useSchemaSystemStore();+const store = useSQLReviewStore();const router = useRouter();const currentUser = useCurrentUser();-const ROUTE_NAME = "setting.workspace.schema-review-policy";+const ROUTE_NAME = "setting.workspace.sql-review";const state = reactive<LocalState>({showDisableModal: false,@@ -257,19 +251,17 @@ const state = reactive<LocalState>({checkedLevel: new Set<RuleLevel>(),});-const hasSchemaReviewPolicyFeature = featureToRef(- "bb.feature.schema-review-policy"-);+const hasSQLReviewPolicyFeature = featureToRef("bb.feature.sql-review");const hasPermission = computed(() => {return isDBAOrOwner(currentUser.value.role);});-const reviewPolicy = computed((): DatabaseSchemaReviewPolicy => {+const reviewPolicy = computed((): SQLReviewPolicy => {return (store.getReviewPolicyByEnvironmentId(- idFromSlug(props.schemaReviewPolicySlug)- ) || (unknown("SCHEMA_REVIEW") as DatabaseSchemaReviewPolicy)+ idFromSlug(props.sqlReviewPolicySlug)+ ) || (unknown("SQL_REVIEW") as SQLReviewPolicy));});@@ -413,7 +405,7 @@ const onRemove = () => {pushNotification({module: "bytebase",style: "SUCCESS",- title: t("schema-review-policy.policy-removed"),+ title: t("sql-review.policy-removed"),});};</script>diff --git a/frontend/src/views/auth/Signup.vue b/frontend/src/views/auth/Signup.vueindex a08bb6a728..45331eee4e 100644--- a/frontend/src/views/auth/Signup.vue+++ b/frontend/src/views/auth/Signup.vue@@ -128,9 +128,11 @@@click="onToggleAcceptTermsAndPolicyCheckbox"><template #terms>- <a href="https://www.bytebase.com/terms?source=console" class="text-accent">{{- $t("auth.sign-up.terms-of-service")- }}</a>+ <a+ href="https://www.bytebase.com/terms?source=console"+ class="text-accent"+ >{{ $t("auth.sign-up.terms-of-service") }}</a+ ></template><template #policy><adiff --git a/plugin/advisor/advisor.go b/plugin/advisor/advisor.goindex bf38fd56f8..7b2dd2225f 100644--- a/plugin/advisor/advisor.go+++ b/plugin/advisor/advisor.go@@ -25,8 +25,8 @@ const (SyntaxErrorTitle string = "Syntax error")-// NewStatusBySchemaReviewRuleLevel returns status by SchemaReviewRuleLevel.-func NewStatusBySchemaReviewRuleLevel(level SchemaReviewRuleLevel) (Status, error) {+// NewStatusBySQLReviewRuleLevel returns status by SQLReviewRuleLevel.+func NewStatusBySQLReviewRuleLevel(level SQLReviewRuleLevel) (Status, error) {switch level {case SchemaRuleLevelError:return Error, nil@@ -143,7 +143,7 @@ type Context struct {Collation string// Schema review rule special fields.- Rule *SchemaReviewRule+ Rule *SQLReviewRuleCatalog catalog.Catalog}@@ -205,8 +205,8 @@ func IsSyntaxCheckSupported(dbType DBType) bool {return false}-// IsSchemaReviewSupported checks the engine type if schema review supports it.-func IsSchemaReviewSupported(dbType DBType) bool {+// IsSQLReviewSupported checks the engine type if schema review supports it.+func IsSQLReviewSupported(dbType DBType) bool {switch dbType {case MySQL, TiDB, Postgres:return truediff --git a/plugin/advisor/mysql/advisor_column_no_null.go b/plugin/advisor/mysql/advisor_column_no_null.goindex fe2f3b2ac4..b3179807a7 100644--- a/plugin/advisor/mysql/advisor_column_no_null.go+++ b/plugin/advisor/mysql/advisor_column_no_null.go@@ -27,7 +27,7 @@ func (adv *ColumnNoNullAdvisor) Check(ctx advisor.Context, statement string) ([]return errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_column_no_null_test.go b/plugin/advisor/mysql/advisor_column_no_null_test.goindex 134e028e90..09e910444a 100644--- a/plugin/advisor/mysql/advisor_column_no_null_test.go+++ b/plugin/advisor/mysql/advisor_column_no_null_test.go@@ -104,7 +104,7 @@ func TestColumnNoNull(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &ColumnNoNullAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &ColumnNoNullAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleColumnNotNull,Level: advisor.SchemaRuleLevelWarning,Payload: "",diff --git a/plugin/advisor/mysql/advisor_column_required.go b/plugin/advisor/mysql/advisor_column_required.goindex a6dfcc0cbe..5c56acd153 100644--- a/plugin/advisor/mysql/advisor_column_required.go+++ b/plugin/advisor/mysql/advisor_column_required.go@@ -29,7 +29,7 @@ func (adv *ColumnRequirementAdvisor) Check(ctx advisor.Context, statement stringreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_column_required_test.go b/plugin/advisor/mysql/advisor_column_required_test.goindex 5ffef3cee3..a7ee42f712 100644--- a/plugin/advisor/mysql/advisor_column_required_test.go+++ b/plugin/advisor/mysql/advisor_column_required_test.go@@ -226,7 +226,7 @@ func TestColumnRequirement(t *testing.T) {},})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &ColumnRequirementAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &ColumnRequirementAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleRequiredColumn,Level: advisor.SchemaRuleLevelWarning,Payload: string(payload),diff --git a/plugin/advisor/mysql/advisor_migration_compatibility.go b/plugin/advisor/mysql/advisor_migration_compatibility.goindex bf0d0bcb7d..10d53ca9f9 100644--- a/plugin/advisor/mysql/advisor_migration_compatibility.go+++ b/plugin/advisor/mysql/advisor_migration_compatibility.go@@ -28,7 +28,7 @@ func (adv *CompatibilityAdvisor) Check(ctx advisor.Context, statement string) ([return errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_migration_compatibility_test.go b/plugin/advisor/mysql/advisor_migration_compatibility_test.goindex 4585bf492e..3be15e88c5 100644--- a/plugin/advisor/mysql/advisor_migration_compatibility_test.go+++ b/plugin/advisor/mysql/advisor_migration_compatibility_test.go@@ -84,7 +84,7 @@ func TestBasic(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &CompatibilityAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &CompatibilityAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleSchemaBackwardCompatibility,Level: advisor.SchemaRuleLevelWarning,Payload: "",@@ -258,7 +258,7 @@ func TestAlterTable(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &CompatibilityAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &CompatibilityAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleSchemaBackwardCompatibility,Level: advisor.SchemaRuleLevelWarning,Payload: "",@@ -324,7 +324,7 @@ func TestAlterTableChangeColumnType(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &CompatibilityAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &CompatibilityAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleSchemaBackwardCompatibility,Level: advisor.SchemaRuleLevelWarning,Payload: "",diff --git a/plugin/advisor/mysql/advisor_naming_column.go b/plugin/advisor/mysql/advisor_naming_column.goindex 893f833cc9..a2537d90c5 100644--- a/plugin/advisor/mysql/advisor_naming_column.go+++ b/plugin/advisor/mysql/advisor_naming_column.go@@ -28,7 +28,7 @@ func (adv *NamingColumnConventionAdvisor) Check(ctx advisor.Context, statement sreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_naming_column_test.go b/plugin/advisor/mysql/advisor_naming_column_test.goindex b0fca12962..60bc914747 100644--- a/plugin/advisor/mysql/advisor_naming_column_test.go+++ b/plugin/advisor/mysql/advisor_naming_column_test.go@@ -168,7 +168,7 @@ func TestNamingColumnConvention(t *testing.T) {MaxLength: 64,})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingColumnConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingColumnConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleColumnNaming,Level: advisor.SchemaRuleLevelWarning,Payload: string(payload),diff --git a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.goindex 1a8ef707b2..0675d89be2 100644--- a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go+++ b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go@@ -28,7 +28,7 @@ func (check *NamingFKConventionAdvisor) Check(ctx advisor.Context, statement strreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go b/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.goindex 7bb124d0fa..edf8a8498e 100644--- a/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go+++ b/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go@@ -81,7 +81,7 @@ func TestNamingFKConvention(t *testing.T) {MaxLength: 64,})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingFKConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingFKConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleFKNaming,Level: advisor.SchemaRuleLevelError,Payload: string(payload),diff --git a/plugin/advisor/mysql/advisor_naming_index_convention.go b/plugin/advisor/mysql/advisor_naming_index_convention.goindex 60ad170704..6eb56ded65 100644--- a/plugin/advisor/mysql/advisor_naming_index_convention.go+++ b/plugin/advisor/mysql/advisor_naming_index_convention.go@@ -32,7 +32,7 @@ func (check *NamingIndexConventionAdvisor) Check(ctx advisor.Context, statementreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_naming_index_convention_test.go b/plugin/advisor/mysql/advisor_naming_index_convention_test.goindex 488a3f15ac..5f175f49f6 100644--- a/plugin/advisor/mysql/advisor_naming_index_convention_test.go+++ b/plugin/advisor/mysql/advisor_naming_index_convention_test.go@@ -133,7 +133,7 @@ func TestNamingIndexConvention(t *testing.T) {MaxLength: 64,})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingIndexConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingIndexConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleIDXNaming,Level: advisor.SchemaRuleLevelError,Payload: string(payload),diff --git a/plugin/advisor/mysql/advisor_naming_table.go b/plugin/advisor/mysql/advisor_naming_table.goindex f64e79701c..33880c196e 100644--- a/plugin/advisor/mysql/advisor_naming_table.go+++ b/plugin/advisor/mysql/advisor_naming_table.go@@ -28,7 +28,7 @@ func (adv *NamingTableConventionAdvisor) Check(ctx advisor.Context, statement streturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_naming_table_test.go b/plugin/advisor/mysql/advisor_naming_table_test.goindex d74541d247..f676bd5fae 100644--- a/plugin/advisor/mysql/advisor_naming_table_test.go+++ b/plugin/advisor/mysql/advisor_naming_table_test.go@@ -113,7 +113,7 @@ func TestMySQLNamingTableConvention(t *testing.T) {MaxLength: 64,})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingTableConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingTableConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleTableNaming,Level: advisor.SchemaRuleLevelError,Payload: string(payload),diff --git a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go b/plugin/advisor/mysql/advisor_naming_unique_key_convention.goindex 6fd28a773f..b9bb1d0d08 100644--- a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go+++ b/plugin/advisor/mysql/advisor_naming_unique_key_convention.go@@ -31,7 +31,7 @@ func (check *NamingUKConventionAdvisor) Check(ctx advisor.Context, statement strreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go b/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.goindex 21322aee09..e4c1bff3fe 100644--- a/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go+++ b/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go@@ -155,7 +155,7 @@ func TestNamingUKConvention(t *testing.T) {MaxLength: 64,})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingUKConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingUKConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleUKNaming,Level: advisor.SchemaRuleLevelError,Payload: string(payload),diff --git a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.goindex 81f8e19f45..359fd1498a 100644--- a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go+++ b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go@@ -32,7 +32,7 @@ func (adv *NoLeadingWildcardLikeAdvisor) Check(ctx advisor.Context, statement streturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like_test.go b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like_test.goindex 5d809f35f5..d666c39fbb 100644--- a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like_test.go+++ b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like_test.go@@ -65,7 +65,7 @@ func TestNoLeadingWildcardLike(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &NoLeadingWildcardLikeAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NoLeadingWildcardLikeAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleStatementNoLeadingWildcardLike,Level: advisor.SchemaRuleLevelError,Payload: "",diff --git a/plugin/advisor/mysql/advisor_stmt_no_select_all.go b/plugin/advisor/mysql/advisor_stmt_no_select_all.goindex fbcd1c152f..5dcba4b028 100644--- a/plugin/advisor/mysql/advisor_stmt_no_select_all.go+++ b/plugin/advisor/mysql/advisor_stmt_no_select_all.go@@ -27,7 +27,7 @@ func (adv *NoSelectAllAdvisor) Check(ctx advisor.Context, statement string) ([]areturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_stmt_no_select_all_test.go b/plugin/advisor/mysql/advisor_stmt_no_select_all_test.goindex 48f7472ff6..7390efe06b 100644--- a/plugin/advisor/mysql/advisor_stmt_no_select_all_test.go+++ b/plugin/advisor/mysql/advisor_stmt_no_select_all_test.go@@ -43,7 +43,7 @@ func TestNoSelectAll(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &NoSelectAllAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NoSelectAllAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleStatementNoSelectAll,Level: advisor.SchemaRuleLevelError,Payload: "",diff --git a/plugin/advisor/mysql/advisor_stmt_where_required.go b/plugin/advisor/mysql/advisor_stmt_where_required.goindex 71a1289838..1a0205f87f 100644--- a/plugin/advisor/mysql/advisor_stmt_where_required.go+++ b/plugin/advisor/mysql/advisor_stmt_where_required.go@@ -28,7 +28,7 @@ func (adv *WhereRequirementAdvisor) Check(ctx advisor.Context, statement string)return errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_stmt_where_required_test.go b/plugin/advisor/mysql/advisor_stmt_where_required_test.goindex 01a5c7f1d3..223bd92113 100644--- a/plugin/advisor/mysql/advisor_stmt_where_required_test.go+++ b/plugin/advisor/mysql/advisor_stmt_where_required_test.go@@ -87,7 +87,7 @@ func TestWhereRequirement(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &WhereRequirementAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &WhereRequirementAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleStatementRequireWhere,Level: advisor.SchemaRuleLevelWarning,Payload: "",diff --git a/plugin/advisor/mysql/advisor_table_no_fk.go b/plugin/advisor/mysql/advisor_table_no_fk.goindex cc0ce4e671..aba4c5839a 100644--- a/plugin/advisor/mysql/advisor_table_no_fk.go+++ b/plugin/advisor/mysql/advisor_table_no_fk.go@@ -27,7 +27,7 @@ func (adv *TableNoFKAdvisor) Check(ctx advisor.Context, statement string) ([]advreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_table_no_fk_test.go b/plugin/advisor/mysql/advisor_table_no_fk_test.goindex 8c33498302..94b2586785 100644--- a/plugin/advisor/mysql/advisor_table_no_fk_test.go+++ b/plugin/advisor/mysql/advisor_table_no_fk_test.go@@ -32,7 +32,7 @@ func TestTableNoFK(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &TableNoFKAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &TableNoFKAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleTableNoFK,Level: advisor.SchemaRuleLevelError,Payload: "",diff --git a/plugin/advisor/mysql/advisor_table_require_pk.go b/plugin/advisor/mysql/advisor_table_require_pk.goindex 9fc208dc86..a29df6ee6d 100644--- a/plugin/advisor/mysql/advisor_table_require_pk.go+++ b/plugin/advisor/mysql/advisor_table_require_pk.go@@ -35,7 +35,7 @@ func (adv *TableRequirePKAdvisor) Check(ctx advisor.Context, statement string) (return errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_table_require_pk_test.go b/plugin/advisor/mysql/advisor_table_require_pk_test.goindex 1dfe126e61..10a33743f4 100644--- a/plugin/advisor/mysql/advisor_table_require_pk_test.go+++ b/plugin/advisor/mysql/advisor_table_require_pk_test.go@@ -212,7 +212,7 @@ func TestRequirePK(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &TableRequirePKAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &TableRequirePKAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleTableRequirePK,Level: advisor.SchemaRuleLevelError,Payload: "",diff --git a/plugin/advisor/mysql/advisor_use_innodb.go b/plugin/advisor/mysql/advisor_use_innodb.goindex 498a8ab657..a89cec1b21 100644--- a/plugin/advisor/mysql/advisor_use_innodb.go+++ b/plugin/advisor/mysql/advisor_use_innodb.go@@ -33,7 +33,7 @@ func (adv *UseInnoDBAdvisor) Check(ctx advisor.Context, statement string) ([]advreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/mysql/advisor_use_innodb_test.go b/plugin/advisor/mysql/advisor_use_innodb_test.goindex 2de234813c..48d4a7c171 100644--- a/plugin/advisor/mysql/advisor_use_innodb_test.go+++ b/plugin/advisor/mysql/advisor_use_innodb_test.go@@ -86,7 +86,7 @@ func TestUseInnoDB(t *testing.T) {},},}- advisor.RunSchemaReviewRuleTests(t, tests, &UseInnoDBAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &UseInnoDBAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleMySQLEngine,Level: advisor.SchemaRuleLevelError,Payload: "",diff --git a/plugin/advisor/pg/advisor_naming_column.go b/plugin/advisor/pg/advisor_naming_column.goindex b898a8dc0e..00ea04aeb3 100644--- a/plugin/advisor/pg/advisor_naming_column.go+++ b/plugin/advisor/pg/advisor_naming_column.go@@ -27,7 +27,7 @@ func (adv *NamingColumnConventionAdvisor) Check(ctx advisor.Context, statement sreturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/pg/advisor_naming_column_test.go b/plugin/advisor/pg/advisor_naming_column_test.goindex cb02ac6546..c2f9fc9f0e 100644--- a/plugin/advisor/pg/advisor_naming_column_test.go+++ b/plugin/advisor/pg/advisor_naming_column_test.go@@ -97,7 +97,7 @@ func TestNamingColumnConvention(t *testing.T) {Format: "^[a-z]+(_[a-z]+)*$",})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingColumnConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingColumnConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleColumnNaming,Level: advisor.SchemaRuleLevelWarning,Payload: string(payload),diff --git a/plugin/advisor/pg/advisor_naming_table.go b/plugin/advisor/pg/advisor_naming_table.goindex 30c8a9c0fc..8535d41ac4 100644--- a/plugin/advisor/pg/advisor_naming_table.go+++ b/plugin/advisor/pg/advisor_naming_table.go@@ -27,7 +27,7 @@ func (adv *NamingTableConventionAdvisor) Check(ctx advisor.Context, statement streturn errAdvice, nil}- level, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/pg/advisor_naming_table_test.go b/plugin/advisor/pg/advisor_naming_table_test.goindex 667664b90d..7b7d78a956 100644--- a/plugin/advisor/pg/advisor_naming_table_test.go+++ b/plugin/advisor/pg/advisor_naming_table_test.go@@ -100,7 +100,7 @@ func TestPostgreSQLNamingTableConvention(t *testing.T) {Format: "^[a-z]+(_[a-z]+)*$",})require.NoError(t, err)- advisor.RunSchemaReviewRuleTests(t, tests, &NamingTableConventionAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &NamingTableConventionAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleTableNaming,Level: advisor.SchemaRuleLevelError,Payload: string(payload),diff --git a/plugin/advisor/pg/advisor_table_require_pk.go b/plugin/advisor/pg/advisor_table_require_pk.goindex 47117f062d..a4b43f86bc 100644--- a/plugin/advisor/pg/advisor_table_require_pk.go+++ b/plugin/advisor/pg/advisor_table_require_pk.go@@ -24,7 +24,7 @@ func (adv *TableRequirePKAdvisor) Check(ctx advisor.Context, statement string) (return errAdvice, nil}- _, err := advisor.NewStatusBySchemaReviewRuleLevel(ctx.Rule.Level)+ _, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)if err != nil {return nil, err}diff --git a/plugin/advisor/pg/advisor_table_require_pk_test.go b/plugin/advisor/pg/advisor_table_require_pk_test.goindex 903ac8adb7..537c712e6d 100644--- a/plugin/advisor/pg/advisor_table_require_pk_test.go+++ b/plugin/advisor/pg/advisor_table_require_pk_test.go@@ -14,7 +14,7 @@ func TestRequirePK(t *testing.T) {},}- advisor.RunSchemaReviewRuleTests(t, tests, &TableRequirePKAdvisor{}, &advisor.SchemaReviewRule{+ advisor.RunSchemaReviewRuleTests(t, tests, &TableRequirePKAdvisor{}, &advisor.SQLReviewRule{Type: advisor.SchemaRuleTableRequirePK,Level: advisor.SchemaRuleLevelError,Payload: "",diff --git a/plugin/advisor/schema_review.go b/plugin/advisor/sql_review.gosimilarity index 79%rename from plugin/advisor/schema_review.gorename to plugin/advisor/sql_review.goindex c796f760ec..555d0f7991 100644--- a/plugin/advisor/schema_review.go+++ b/plugin/advisor/sql_review.go@@ -14,55 +14,55 @@ import (// 1. Implement an advisor.(plugin/advisor/mysql or plugin/advisor/pg)// 2. Register this advisor in map[DBType][AdvisorType].(plugin/advisor.go)// 3. Add advisor error code if needed(plugin/advisor/code.go).-// 4. Map SchemaReviewRuleType to advisor.Type in getAdvisorTypeByRule(current file).+// 4. Map SQLReviewRuleType to advisor.Type in getAdvisorTypeByRule(current file).-// SchemaReviewRuleLevel is the error level for schema review rule.-type SchemaReviewRuleLevel string+// SQLReviewRuleLevel is the error level for schema review rule.+type SQLReviewRuleLevel string-// SchemaReviewRuleType is the type of schema rule.-type SchemaReviewRuleType string+// SQLReviewRuleType is the type of schema rule.+type SQLReviewRuleType stringconst (- // SchemaRuleLevelError is the error level of SchemaReviewRuleLevel.- SchemaRuleLevelError SchemaReviewRuleLevel = "ERROR"- // SchemaRuleLevelWarning is the warning level of SchemaReviewRuleLevel.- SchemaRuleLevelWarning SchemaReviewRuleLevel = "WARNING"- // SchemaRuleLevelDisabled is the disabled level of SchemaReviewRuleLevel.- SchemaRuleLevelDisabled SchemaReviewRuleLevel = "DISABLED"+ // SchemaRuleLevelError is the error level of SQLReviewRuleLevel.+ SchemaRuleLevelError SQLReviewRuleLevel = "ERROR"+ // SchemaRuleLevelWarning is the warning level of SQLReviewRuleLevel.+ SchemaRuleLevelWarning SQLReviewRuleLevel = "WARNING"+ // SchemaRuleLevelDisabled is the disabled level of SQLReviewRuleLevel.+ SchemaRuleLevelDisabled SQLReviewRuleLevel = "DISABLED"// SchemaRuleMySQLEngine require InnoDB as the storage engine.- SchemaRuleMySQLEngine SchemaReviewRuleType = "engine.mysql.use-innodb"+ SchemaRuleMySQLEngine SQLReviewRuleType = "engine.mysql.use-innodb"// SchemaRuleTableNaming enforce the table name format.- SchemaRuleTableNaming SchemaReviewRuleType = "naming.table"+ SchemaRuleTableNaming SQLReviewRuleType = "naming.table"// SchemaRuleColumnNaming enforce the column name format- SchemaRuleColumnNaming SchemaReviewRuleType = "naming.column"+ SchemaRuleColumnNaming SQLReviewRuleType = "naming.column"// SchemaRuleUKNaming enforce the unique key name format.- SchemaRuleUKNaming SchemaReviewRuleType = "naming.index.uk"+ SchemaRuleUKNaming SQLReviewRuleType = "naming.index.uk"// SchemaRuleFKNaming enforce the foreign key name format.- SchemaRuleFKNaming SchemaReviewRuleType = "naming.index.fk"+ SchemaRuleFKNaming SQLReviewRuleType = "naming.index.fk"// SchemaRuleIDXNaming enforce the index name format.- SchemaRuleIDXNaming SchemaReviewRuleType = "naming.index.idx"+ SchemaRuleIDXNaming SQLReviewRuleType = "naming.index.idx"// SchemaRuleStatementNoSelectAll disallow 'SELECT *'.- SchemaRuleStatementNoSelectAll SchemaReviewRuleType = "statement.select.no-select-all"+ SchemaRuleStatementNoSelectAll SQLReviewRuleType = "statement.select.no-select-all"// SchemaRuleStatementRequireWhere require 'WHERE' clause.- SchemaRuleStatementRequireWhere SchemaReviewRuleType = "statement.where.require"+ SchemaRuleStatementRequireWhere SQLReviewRuleType = "statement.where.require"// SchemaRuleStatementNoLeadingWildcardLike disallow leading '%' in LIKE, e.g. LIKE foo = '%x' is not allowed.- SchemaRuleStatementNoLeadingWildcardLike SchemaReviewRuleType = "statement.where.no-leading-wildcard-like"+ SchemaRuleStatementNoLeadingWildcardLike SQLReviewRuleType = "statement.where.no-leading-wildcard-like"// SchemaRuleTableRequirePK require the table to have a primary key.- SchemaRuleTableRequirePK SchemaReviewRuleType = "table.require-pk"+ SchemaRuleTableRequirePK SQLReviewRuleType = "table.require-pk"// SchemaRuleTableNoFK require the table disallow the foreign key.- SchemaRuleTableNoFK SchemaReviewRuleType = "table.no-foreign-key"+ SchemaRuleTableNoFK SQLReviewRuleType = "table.no-foreign-key"// SchemaRuleRequiredColumn enforce the required columns in each table.- SchemaRuleRequiredColumn SchemaReviewRuleType = "column.required"+ SchemaRuleRequiredColumn SQLReviewRuleType = "column.required"// SchemaRuleColumnNotNull enforce the columns cannot have NULL value.- SchemaRuleColumnNotNull SchemaReviewRuleType = "column.no-null"+ SchemaRuleColumnNotNull SQLReviewRuleType = "column.no-null"// SchemaRuleSchemaBackwardCompatibility enforce the MySQL and TiDB support check whether the schema change is backward compatible.- SchemaRuleSchemaBackwardCompatibility SchemaReviewRuleType = "schema.backward-compatibility"+ SchemaRuleSchemaBackwardCompatibility SQLReviewRuleType = "schema.backward-compatibility"// TableNameTemplateToken is the token for table nameTableNameTemplateToken = "{{table}}"@@ -83,7 +83,7 @@ const (var (// TemplateNamingTokens is the mapping for rule type to template token- TemplateNamingTokens = map[SchemaReviewRuleType]map[string]bool{+ TemplateNamingTokens = map[SQLReviewRuleType]map[string]bool{SchemaRuleIDXNaming: {TableNameTemplateToken: true,ColumnListTemplateToken: true,@@ -101,14 +101,14 @@ var (})-// SchemaReviewPolicy is the policy configuration for schema review.-type SchemaReviewPolicy struct {- Name string `json:"name"`- RuleList []*SchemaReviewRule `json:"ruleList"`+// SQLReviewPolicy is the policy configuration for schema review.+type SQLReviewPolicy struct {+ Name string `json:"name"`+ RuleList []*SQLReviewRule `json:"ruleList"`}-// Validate validates the SchemaReviewPolicy. It also validates the each review rule.-func (policy *SchemaReviewPolicy) Validate() error {+// Validate validates the SQLReviewPolicy. It also validates the each review rule.+func (policy *SQLReviewPolicy) Validate() error {if policy.Name == "" || len(policy.RuleList) == 0 {return fmt.Errorf("invalid payload, name or rule list cannot be empty")}@@ -120,17 +120,17 @@ func (policy *SchemaReviewPolicy) Validate() error {return nil}-// SchemaReviewRule is the rule for schema review policy.-type SchemaReviewRule struct {- Type SchemaReviewRuleType `json:"type"`- Level SchemaReviewRuleLevel `json:"level"`+// SQLReviewRule is the rule for schema review policy.+type SQLReviewRule struct {+ Type SQLReviewRuleType `json:"type"`+ Level SQLReviewRuleLevel `json:"level"`// Payload is the stringify value for XXXRulePayload (e.g. NamingRulePayload, RequiredColumnRulePayload)// If the rule doesn't have any payload configuration, the payload would be "{}"Payload string `json:"payload"`}// Validate validates the schema review rule.-func (rule *SchemaReviewRule) Validate() error {+func (rule *SQLReviewRule) Validate() error {// TODO(rebelice): add other schema review rule validation.switch rule.Type {case SchemaRuleTableNaming, SchemaRuleColumnNaming:@@ -184,7 +184,7 @@ func UnamrshalNamingRulePayloadAsRegexp(payload string) (*regexp.Regexp, int, er// UnmarshalNamingRulePayloadAsTemplate will unmarshal payload to NamingRulePayload and extract all the template keys.// For example, "hard_code_{{table}}_{{column}}_end" will return// "hard_code_{{table}}_{{column}}_end", ["{{table}}", "{{column}}"]-func UnmarshalNamingRulePayloadAsTemplate(ruleType SchemaReviewRuleType, payload string) (string, []string, int, error) {+func UnmarshalNamingRulePayloadAsTemplate(ruleType SQLReviewRuleType, payload string) (string, []string, int, error) {var nr NamingRulePayloadif err := json.Unmarshal([]byte(payload), &nr); err != nil {return "", nil, 0, fmt.Errorf("failed to unmarshal naming rule payload %q: %q", payload, err)@@ -241,8 +241,8 @@ func UnmarshalRequiredColumnRulePayload(payload string) (*RequiredColumnRulePaylreturn &rcr, nil}-// SchemaReviewCheckContext is the context for schema review check.-type SchemaReviewCheckContext struct {+// SQLReviewCheckContext is the context for schema review check.+type SQLReviewCheckContext struct {Charset stringCollation stringDbType DBType@@ -250,7 +250,7 @@ type SchemaReviewCheckContext struct {}// SchemaReviewCheck checks the statments with schema review policy.-func SchemaReviewCheck(ctx context.Context, statements string, policy *SchemaReviewPolicy, context SchemaReviewCheckContext) ([]Advice, error) {+func SchemaReviewCheck(ctx context.Context, statements string, policy *SQLReviewPolicy, context SQLReviewCheckContext) ([]Advice, error) {var result []Advicefor _, rule := range policy.RuleList {if rule.Level == SchemaRuleLevelDisabled {@@ -296,7 +296,7 @@ func SchemaReviewCheck(ctx context.Context, statements string, policy *SchemaRevreturn result, nil}-func getAdvisorTypeByRule(ruleType SchemaReviewRuleType, engine DBType) (Type, error) {+func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine DBType) (Type, error) {switch ruleType {case SchemaRuleStatementRequireWhere:switch engine {diff --git a/plugin/advisor/utils_for_tests.go b/plugin/advisor/utils_for_tests.goindex dc40bf6552..61d4e3d988 100644--- a/plugin/advisor/utils_for_tests.go+++ b/plugin/advisor/utils_for_tests.go@@ -64,7 +64,7 @@ func RunSchemaReviewRuleTests(t *testing.T,tests []TestCase,adv Advisor,- rule *SchemaReviewRule,+ rule *SQLReviewRule,catalog catalog.Catalog,) {ctx := Context{diff --git a/server/policy.go b/server/policy.goindex 72a5ad681a..26867a4fbe 100644--- a/server/policy.go+++ b/server/policy.go@@ -38,8 +38,8 @@ func (s *Server) hasAccessToUpsertPolicy(policyUpsert *api.PolicyUpsert) error {return fmt.Errorf(api.FeatureBackupPolicy.AccessErrorMessage())}case api.PolicyTypeSchemaReview:- if !s.feature(api.FeatureSchemaReviewPolicy) {- return fmt.Errorf(api.FeatureSchemaReviewPolicy.AccessErrorMessage())+ if !s.feature(api.FeatureSQLReviewPolicy) {+ return fmt.Errorf(api.FeatureSQLReviewPolicy.AccessErrorMessage())}}return nildiff --git a/server/sql.go b/server/sql.goindex 2fc24f5279..d30f6a46b1 100644--- a/server/sql.go+++ b/server/sql.go@@ -159,7 +159,7 @@ func (s *Server) registerSQLRoutes(g *echo.Group) {adviceLevel := advisor.SuccessadviceList := []advisor.Advice{}- if s.feature(api.FeatureSchemaReviewPolicy) && api.IsSchemaReviewSupported(instance.Engine, s.profile.Mode) {+ if s.feature(api.FeatureSQLReviewPolicy) && api.IsSQLReviewSupported(instance.Engine, s.profile.Mode) {dbType, err := api.ConvertToAdvisorDBType(instance.Engine)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to convert db type %v into advisor db type", instance.Engine))@@ -814,7 +814,7 @@ func (s *Server) sqlCheck(return advisor.Error, nil, err}- res, err := advisor.SchemaReviewCheck(ctx, statement, policy, advisor.SchemaReviewCheckContext{+ res, err := advisor.SchemaReviewCheck(ctx, statement, policy, advisor.SQLReviewCheckContext{Charset: dbCharacterSet,Collation: dbCollation,DbType: dbType,diff --git a/server/task.go b/server/task.goindex 011fa185b8..5cd0c47120 100644--- a/server/task.go+++ b/server/task.go@@ -238,7 +238,7 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {}}- if s.feature(api.FeatureSchemaReviewPolicy) && api.IsSchemaReviewSupported(task.Database.Instance.Engine, s.profile.Mode) {+ if s.feature(api.FeatureSQLReviewPolicy) && api.IsSQLReviewSupported(task.Database.Instance.Engine, s.profile.Mode) {if err := s.triggerDatabaseStatementAdviseTask(ctx, *taskPatch.Statement, taskPatched); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to trigger database statement advise task, err: %w", err)).SetInternal(err)}diff --git a/server/task_check_executor_statement_advisor_composite.go b/server/task_check_executor_statement_advisor_composite.goindex 7f045a2505..608d72f58d 100644--- a/server/task_check_executor_statement_advisor_composite.go+++ b/server/task_check_executor_statement_advisor_composite.go@@ -31,8 +31,8 @@ func (exec *TaskCheckStatementAdvisorCompositeExecutor) Run(ctx context.Context,if taskCheckRun.Type != api.TaskCheckDatabaseStatementAdvise {return nil, common.Errorf(common.Invalid, fmt.Errorf("invalid check statement advisor composite type: %v", taskCheckRun.Type))}- if !server.feature(api.FeatureSchemaReviewPolicy) {- return nil, common.Errorf(common.NotAuthorized, fmt.Errorf(api.FeatureSchemaReviewPolicy.AccessErrorMessage()))+ if !server.feature(api.FeatureSQLReviewPolicy) {+ return nil, common.Errorf(common.NotAuthorized, fmt.Errorf(api.FeatureSQLReviewPolicy.AccessErrorMessage()))}payload := &api.TaskCheckDatabaseStatementAdvisePayload{}@@ -68,7 +68,7 @@ func (exec *TaskCheckStatementAdvisorCompositeExecutor) Run(ctx context.Context,return nil, err}- adviceList, err := advisor.SchemaReviewCheck(ctx, payload.Statement, policy, advisor.SchemaReviewCheckContext{+ adviceList, err := advisor.SchemaReviewCheck(ctx, payload.Statement, policy, advisor.SQLReviewCheckContext{Charset: payload.Charset,Collation: payload.Collation,DbType: dbType,diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.goindex 01ec2ecfcd..4b3930c0e2 100644--- a/server/task_check_scheduler.go+++ b/server/task_check_scheduler.go@@ -333,7 +333,7 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap}}- if s.server.feature(api.FeatureSchemaReviewPolicy) && api.IsSchemaReviewSupported(database.Instance.Engine, s.server.profile.Mode) {+ if s.server.feature(api.FeatureSQLReviewPolicy) && api.IsSQLReviewSupported(database.Instance.Engine, s.server.profile.Mode) {policyID, err := s.server.store.GetSchemaReviewPolicyIDByEnvID(ctx, task.Instance.EnvironmentID)if err != nil {return nil, fmt.Errorf("failed to get schema review policy ID for task: %v, in environment: %v, err: %w", task.Name, task.Instance.EnvironmentID, err)diff --git a/server/task_scheduler.go b/server/task_scheduler.goindex 619b203bcd..48ac5aef3d 100644--- a/server/task_scheduler.go+++ b/server/task_scheduler.go@@ -287,7 +287,7 @@ func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*}}- if s.server.feature(api.FeatureSchemaReviewPolicy) && api.IsSchemaReviewSupported(instance.Engine, s.server.profile.Mode) {+ if s.server.feature(api.FeatureSQLReviewPolicy) && api.IsSQLReviewSupported(instance.Engine, s.server.profile.Mode) {pass, err = s.server.passCheck(ctx, s.server, task, api.TaskCheckDatabaseStatementAdvise)if err != nil {return nil, errdiff --git a/store/policy.go b/store/policy.goindex 0a5b42be5f..ee61809a25 100644--- a/store/policy.go+++ b/store/policy.go@@ -178,7 +178,7 @@ func (s *Store) GetPipelineApprovalPolicy(ctx context.Context, environmentID int}// GetNormalSchemaReviewPolicy will get the normal schema review policy for an environment.-func (s *Store) GetNormalSchemaReviewPolicy(ctx context.Context, find *api.PolicyFind) (*advisor.SchemaReviewPolicy, error) {+func (s *Store) GetNormalSchemaReviewPolicy(ctx context.Context, find *api.PolicyFind) (*advisor.SQLReviewPolicy, error) {if find.ID != nil && *find.ID == api.DefaultPolicyID {return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("schema review policy not found with ID %d", *find.ID)}}@@ -195,7 +195,7 @@ func (s *Store) GetNormalSchemaReviewPolicy(ctx context.Context, find *api.Policif policy.ID == api.DefaultPolicyID {return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("schema review policy ID: %d for environment %d not found", policy.ID, policy.EnvironmentID)}}- return api.UnmarshalSchemaReviewPolicy(policy.Payload)+ return api.UnmarshalSQLReviewPolicy(policy.Payload)}// GetSchemaReviewPolicyIDByEnvID will get the schema review policy ID for an environment.diff --git a/tests/schema_system_test.go b/tests/sql_review_test.gosimilarity index 98%rename from tests/schema_system_test.gorename to tests/sql_review_test.goindex fee48bd0a4..12a7edbd2b 100644--- a/tests/schema_system_test.go+++ b/tests/sql_review_test.go@@ -20,15 +20,15 @@ import ("github.com/stretchr/testify/require")-func TestSchemaSystem(t *testing.T) {+func TestSQLReview(t *testing.T) {type test struct {statement stringresult []api.TaskCheckResult}var (- databaseName = "testSchemaSystem"- schemaReviewAccessErr = fmt.Sprintf(`http response error code %d body "{\"message\":\"%s\"}\n"`, http.StatusForbidden, api.FeatureSchemaReviewPolicy.AccessErrorMessage())+ databaseName = "testSQLReview"+ schemaReviewAccessErr = fmt.Sprintf(`http response error code %d body "{\"message\":\"%s\"}\n"`, http.StatusForbidden, api.FeatureSQLReviewPolicy.AccessErrorMessage())statements = []string{"CREATE TABLE user(" +"id INT PRIMARY KEY," +@@ -276,8 +276,8 @@ func TestSchemaSystem(t *testing.T) {// Create a project.project, err := ctl.createProject(api.ProjectCreate{- Name: "Test Schema System Project",- Key: "TestSchemaSystem",+ Name: "Test SQL Review Project",+ Key: "TestSQLReview",})a.NoError(err)diff --git a/tests/tests.go b/tests/tests.goindex b356edb689..65db606a13 100644--- a/tests/tests.go+++ b/tests/tests.go@@ -141,7 +141,7 @@ func getTestPort(testName string) int {"TestCheckServerVersionAndBinlogForPITR","TestFetchBinlogFiles",- "TestSchemaSystem",+ "TestSQLReview",}port := 1234for _, name := range tests {@@ -1420,7 +1420,7 @@ func (ctl *controller) getSchemaReviewResult(id int) ([]api.TaskCheckResult, err}// setDefaultSchemaReviewRulePayload sets the default payload for this rule.-func setDefaultSchemaReviewRulePayload(ruleTp advisor.SchemaReviewRuleType) (string, error) {+func setDefaultSchemaReviewRulePayload(ruleTp advisor.SQLReviewRuleType) (string, error) {var payload []bytevar err errorswitch ruleTp {@@ -1472,9 +1472,9 @@ func setDefaultSchemaReviewRulePayload(ruleTp advisor.SchemaReviewRuleType) (str// prodTemplateSchemaReviewPolicy returns the default schema review policy.func prodTemplateSchemaReviewPolicy() (string, error) {- policy := advisor.SchemaReviewPolicy{+ policy := advisor.SQLReviewPolicy{Name: "Prod",- RuleList: []*advisor.SchemaReviewRule{+ RuleList: []*advisor.SQLReviewRule{{Type: advisor.SchemaRuleMySQLEngine,Level: advisor.SchemaRuleLevelError,