Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add changeType parameter (#10975)

Liu Ji0de5adb4b009
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
index 056c6e4380..53a9e56991 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
@@ -1,10 +1,9 @@
<template>
- <template v-if="allowEnableGhost">
- <span class="border-r border-control-border ml-1"></span>
- <span class="normal-link ml-1 inline-block" @click="enableGhost">
+ <div v-if="allowEnableGhost">
+ <div class="normal-link inline-block" @click="enableGhost">
{{ $t("task.online-migration.enable") }}
- </span>
- </template>
+ </div>
+ </div>
</template>
<script setup lang="ts">
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
index 3fd1328b41..953ea62aed 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
@@ -9,6 +9,7 @@
:key="selectedTask.uid"
:get-statement="getStatement"
:database="database"
+ :change-type="changeType"
:button-props="{
size: 'tiny',
}"
@@ -42,7 +43,10 @@ import { useIssueContext, databaseForTask } from "@/components/IssueV1/logic";
import { SQLCheckButton } from "@/components/SQLCheck";
import { TaskTypeListWithStatement } from "@/types";
import { Task_Type } from "@/types/proto/v1/rollout_service";
+import { CheckRequest_ChangeType } from "@/types/proto/v1/sql_service";
import { Defer } from "@/utils/util";
+import { isGhostEnabledForTask } from "../Sidebar/GhostSection/common";
+import OnlineMigrationAdviceExtra from "./OnlineMigrationAdviceExtra.vue";
import SQLCheckBadge from "./SQLCheckBadge.vue";
const { issue, selectedTask, events } = useIssueContext();
@@ -77,4 +81,11 @@ const handleToggleOnlineMigration = (on: boolean, confirm: Defer<boolean>) => {
confirm.resolve(false);
}
};
+
+const changeType = computed((): CheckRequest_ChangeType | undefined => {
+ if (isGhostEnabledForTask(issue.value, selectedTask.value)) {
+ return CheckRequest_ChangeType.DDL_GHOST;
+ }
+ return undefined;
+});
</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts
index a9b74c5db5..76fcde0b49 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts
+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts
@@ -235,3 +235,9 @@ export const ghostViewTypeForTask = (
}
return "NONE";
};
+
+export const isGhostEnabledForTask = (issue: ComposedIssue, task: Task) => {
+ const spec = specForTask(issue.planEntity, task);
+ const config = spec?.changeDatabaseConfig;
+ return config?.type === Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST;
+};
diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vue
index 235b31d0c9..7ed43c8cdb 100644
--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckButton.vue
@@ -73,7 +73,11 @@ import { SETTING_ROUTE_WORKSPACE_SQL_REVIEW } from "@/router/dashboard/workspace
import { useCurrentUserV1, useSQLReviewStore } from "@/store";
import { ComposedDatabase } from "@/types";
import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import { Advice, Advice_Status } from "@/types/proto/v1/sql_service";
+import {
+ Advice,
+ Advice_Status,
+ CheckRequest_ChangeType,
+} from "@/types/proto/v1/sql_service";
import { Defer, VueStyle, defer, hasWorkspacePermissionV2 } from "@/utils";
import ErrorList from "../misc/ErrorList.vue";
import SQLCheckPanel from "./SQLCheckPanel.vue";
@@ -86,11 +90,13 @@ const props = withDefaults(
databaseMetadata?: DatabaseMetadata;
buttonProps?: ButtonProps;
buttonStyle?: VueStyle;
+ changeType?: CheckRequest_ChangeType;
}>(),
{
databaseMetadata: undefined,
buttonProps: undefined,
buttonStyle: undefined,
+ changeType: undefined,
}
);
@@ -137,11 +143,12 @@ const runCheckInternal = async (
statement: string,
databaseMetadata: DatabaseMetadata | undefined
) => {
- const { database } = props;
+ const { database, changeType } = props;
const result = await sqlServiceClient.check({
statement,
database: database.name,
metadata: databaseMetadata,
+ changeType,
});
return result;
};