Skip to content

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

chore(frontend): update gh-ost section (#15274)

boojackcfd99e64147b
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
index f9b3bee57c..9d3b494530 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
@@ -86,10 +86,6 @@
<SchemaEditorSQLCheckButton
:database-list="databaseList"
:get-statement="generateOrGetEditingDDL"
- :use-online-schema-migration="state.useOnlineSchemaMigration"
- @toggle-online-schema-migration="
- state.useOnlineSchemaMigration = $event
- "
/>
</template>
</NTabs>
@@ -103,12 +99,6 @@
>
{{ $t("issue.sql-review-only") }}
</NCheckbox>
- <NCheckbox
- v-if="allowUseOnlineSchemaMigration"
- v-model:checked="state.useOnlineSchemaMigration"
- >
- {{ $t("task.online-migration.enable") }}
- </NCheckbox>
<NButton @click="dismissModal">
{{ $t("common.cancel") }}
</NButton>
@@ -165,7 +155,6 @@ import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
import { DatabaseChangeMode } from "@/types/proto/v1/setting_service";
import {
TinyTimer,
- allowGhostMigrationV1,
defer,
extractProjectResourceName,
generateIssueTitle,
@@ -192,7 +181,6 @@ interface LocalState {
isUploadingFile: boolean;
// planOnly is used to indicate whether only to create plan.
planOnly: boolean;
- useOnlineSchemaMigration: boolean;
}
const props = defineProps({
@@ -231,7 +219,6 @@ const state = reactive<LocalState>({
targets: [],
isUploadingFile: false,
planOnly: props.planOnly,
- useOnlineSchemaMigration: false,
});
const databaseV1Store = useDatabaseV1Store();
const dbCatalogStore = useDatabaseCatalogV1Store();
@@ -275,13 +262,6 @@ const editTargetsKey = computed(() => {
});
});
-const allowUseOnlineSchemaMigration = computed(() => {
- return (
- databaseChangeMode.value === DatabaseChangeMode.PIPELINE &&
- allowGhostMigrationV1(databaseList.value)
- );
-});
-
const prepareDatabaseMetadata = async () => {
state.isPreparingMetadata = true;
state.targets = [];
@@ -459,9 +439,6 @@ const handlePreviewIssue = async () => {
template: "bb.issue.database.schema.update",
};
query.databaseList = databaseList.value.map((db) => db.name).join(",");
- if (state.useOnlineSchemaMigration) {
- query.ghost = "1";
- }
if (state.selectedTab === "raw-sql") {
query.name = generateIssueTitle(
@@ -514,8 +491,7 @@ const handlePreviewIssue = async () => {
const databaseNameList = databaseList.value.map((db) => db.databaseName);
query.name = generateIssueTitle(
"bb.issue.database.schema.update",
- databaseNameList,
- !!query.ghost
+ databaseNameList
);
}
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/OnlineMigrationAdviceExtra.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/OnlineMigrationAdviceExtra.vue
deleted file mode 100644
index 77052309e0..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/OnlineMigrationAdviceExtra.vue
+++ /dev/null
@@ -1,54 +0,0 @@
-<template>
- <NButton
- v-if="advise"
- size="small"
- type="primary"
- @click="toggleGhost(advise.on)"
- >
- {{ advise.text() }}
- </NButton>
-</template>
-
-<script setup lang="ts">
-import { NButton } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type { PlanCheckDetailTableRow } from "@/components/PlanCheckRun/PlanCheckRunDetail.vue";
-
-const props = defineProps<{
- row: PlanCheckDetailTableRow;
-}>();
-
-const emit = defineEmits<{
- (event: "toggle", on: boolean): void;
-}>();
-
-const { t } = useI18n();
-
-const code = computed(() => {
- return props.row.checkResult.code;
-});
-
-const advise = computed(() => {
- if (!code.value) {
- return undefined;
- }
- if (code.value === 1801) {
- return {
- text: () => t("task.online-migration.enable"),
- on: true,
- };
- }
- if (code.value === 1803) {
- return {
- text: () => t("task.online-migration.disable"),
- on: false,
- };
- }
- return undefined;
-});
-
-const toggleGhost = (on: boolean) => {
- emit("toggle", on);
-};
-</script>
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
index 0e74f4fcde..25377febbd 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
@@ -3,34 +3,20 @@
v-if="show"
:database="database"
:get-statement="getStatement"
- :change-type="
- useOnlineSchemaMigration
- ? Release_File_ChangeType.DDL_GHOST
- : Release_File_ChangeType.DDL
- "
+ :change-type="Release_File_ChangeType.DDL"
:button-props="{
size: 'small',
}"
:show-code-location="false"
:advice-filter="(advice) => advice.title !== 'advice.online-migration'"
class="justify-end"
- >
- <template #row-title-extra="{ row, confirm }">
- <OnlineMigrationAdviceExtra
- v-if="row.checkResult.title === 'advice.online-migration'"
- :row="row"
- @toggle="handleToggleOnlineMigration($event, confirm)"
- />
- </template>
- </SQLCheckButton>
+ />
</template>
<script lang="ts" setup>
import { toRef } from "vue";
import { SQLCheckButton } from "@/components/SQLCheck";
import type { ComposedDatabase } from "@/types";
import { Release_File_ChangeType } from "@/types/proto/v1/release_service";
-import type { Defer } from "@/utils";
-import OnlineMigrationAdviceExtra from "./OnlineMigrationAdviceExtra.vue";
import { useSchemaEditorSQLCheck } from "./useSchemaEditorSQLCheck";
const props = defineProps<{
@@ -39,22 +25,9 @@ const props = defineProps<{
statement: string;
errors: string[];
}>;
- useOnlineSchemaMigration: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "toggle-online-schema-migration", on: boolean): void;
}>();
const { show, database } = useSchemaEditorSQLCheck({
databaseList: toRef(props, "databaseList"),
});
-
-const handleToggleOnlineMigration = (
- on: boolean,
- confirm: Defer<boolean> | undefined
-) => {
- emit("toggle-online-schema-migration", on);
- confirm?.resolve(false);
-};
</script>
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
deleted file mode 100644
index 7d544961cd..0000000000
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
+++ /dev/null
@@ -1,66 +0,0 @@
-<template>
- <NButton
- v-if="advise"
- size="small"
- type="primary"
- @click="toggleGhost(advise.on)"
- >
- {{ advise.text() }}
- </NButton>
-</template>
-
-<script setup lang="ts">
-import { NButton } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { type PlanCheckDetailTableRow } from "@/components/PlanCheckRun/PlanCheckRunDetail.vue";
-import { isGroupingChangeTaskV1, useIssueContext } from "../../logic";
-import { allowGhostForTask } from "../Sidebar/GhostSection/common";
-
-const emit = defineEmits<{
- (event: "toggle", on: boolean): void;
-}>();
-
-const props = defineProps<{
- row: PlanCheckDetailTableRow;
-}>();
-
-const { t } = useI18n();
-const { isCreating, issue, selectedTask } = useIssueContext();
-
-const code = computed(() => {
- return props.row.checkResult.code;
-});
-
-const advise = computed(() => {
- if (!isCreating.value) {
- return undefined;
- }
- if (!code.value) {
- return undefined;
- }
- if (isGroupingChangeTaskV1(issue.value, selectedTask.value)) {
- return undefined;
- }
- if (!allowGhostForTask(issue.value, selectedTask.value)) {
- return undefined;
- }
- if (code.value === 1801) {
- return {
- text: () => t("task.online-migration.enable"),
- on: true,
- };
- }
- if (code.value === 1803) {
- return {
- text: () => t("task.online-migration.disable"),
- on: false,
- };
- }
- return undefined;
-});
-
-const toggleGhost = (on: boolean) => {
- emit("toggle", on);
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
index 8664f7b088..a5d028aa85 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
@@ -28,15 +28,7 @@
:database="database"
:advices="advices"
@close="showDetailPanel = false"
- >
- <template #row-title-extra="{ row }">
- <OnlineMigrationAdviceExtra
- v-if="row.checkResult.title === 'advice.online-migration'"
- :row="row"
- @toggle="handleToggleOnlineMigration"
- />
- </template>
- </SQLCheckPanel>
+ />
</button>
</template>
@@ -46,7 +38,6 @@ import { SQLCheckPanel } from "@/components/SQLCheck";
import type { Advice } from "@/types/proto/v1/sql_service";
import { Advice_Status } from "@/types/proto/v1/sql_service";
import { databaseForTask, useIssueContext } from "../../logic";
-import OnlineMigrationAdviceExtra from "./OnlineMigrationAdviceExtra.vue";
import { TaskSpinner } from "../common";
const props = defineProps<{
@@ -58,7 +49,7 @@ defineEmits<{
(event: "click"): void;
}>();
-const { issue, selectedTask, events } = useIssueContext();
+const { issue, selectedTask } = useIssueContext();
const showDetailPanel = ref(false);
const database = computed(() => {
@@ -123,11 +114,4 @@ const buttonClasses = computed(() => {
const handleClick = () => {
showDetailPanel.value = true;
};
-
-const handleToggleOnlineMigration = (on: boolean) => {
- events.emit("toggle-online-migration", {
- on,
- });
- showDetailPanel.value = true;
-};
</script>
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
index 28a6393c64..c16a875c2d 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
@@ -26,14 +26,6 @@
</template>
<SQLCheckBadge v-else :is-running="isRunning" :advices="advices" />
</template>
-
- <template #row-title-extra="{ row, confirm }">
- <OnlineMigrationAdviceExtra
- v-if="row.checkResult.title === 'advice.online-migration'"
- :row="row"
- @toggle="handleToggleOnlineMigration($event, confirm)"
- />
- </template>
</SQLCheckButton>
</div>
</template>
@@ -51,16 +43,14 @@ import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
import { Release_File_ChangeType } from "@/types/proto/v1/release_service";
import { Task_Type } from "@/types/proto/v1/rollout_service";
import { Advice } from "@/types/proto/v1/sql_service";
-import type { Defer } from "@/utils/util";
import { useTaskSheet } from "../StatementSection/useTaskSheet";
-import OnlineMigrationAdviceExtra from "./OnlineMigrationAdviceExtra.vue";
import SQLCheckBadge from "./SQLCheckBadge.vue";
defineEmits<{
(event: "update:advices", advices: Advice[] | undefined): void;
}>();
-const { issue, selectedTask, events } = useIssueContext();
+const { issue, selectedTask } = useIssueContext();
const { sheetStatement } = useTaskSheet();
const database = computed(() => {
@@ -85,16 +75,6 @@ const getStatement = async () => {
};
};
-const handleToggleOnlineMigration = (
- on: boolean,
- confirm: Defer<boolean> | undefined
-) => {
- events.emit("toggle-online-migration", {
- on,
- });
- confirm?.resolve(false);
-};
-
const changeType = computed((): Release_File_ChangeType | undefined => {
const spec = specForTask(issue.value.planEntity, selectedTask.value);
switch (spec?.changeDatabaseConfig?.type) {
diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue
index 97c11ba1c0..eeb526d66a 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue
@@ -34,7 +34,7 @@
<LockIcon class="w-4 h-4 text-accent" />
</FeatureBadgeForInstanceLicense>
</div>
- <GhostSwitch v-if="isCreating" />
+ <GhostSwitch />
</div>
<GhostConfigButton v-if="viewType === 'ON'" />
@@ -58,17 +58,13 @@ import FeatureBadgeForInstanceLicense from "@/components/FeatureGuard/FeatureBad
import { databaseForTask, useIssueContext } from "@/components/IssueV1/logic";
import LearnMoreLink from "@/components/LearnMoreLink.vue";
import { featureToRef } from "@/store";
-import { flattenTaskV1List, isDatabaseChangeRelatedIssue } from "@/utils";
+import { isDatabaseChangeRelatedIssue } from "@/utils";
import GhostConfigButton from "./GhostConfigButton.vue";
import GhostFlagsPanel from "./GhostFlagsPanel.vue";
import GhostSwitch from "./GhostSwitch.vue";
-import {
- allowGhostForDatabase,
- ghostViewTypeForTask,
- provideIssueGhostContext,
-} from "./common";
+import { allowGhostForTask, provideIssueGhostContext } from "./common";
-const { isCreating, issue, selectedTask: task } = useIssueContext();
+const { isCreating, issue, selectedTask } = useIssueContext();
const { viewType, showFeatureModal, showMissingInstanceLicense } =
provideIssueGhostContext();
@@ -84,26 +80,16 @@ const shouldShowGhostSection = computed(() => {
return false;
}
- // We need all tasks and specs to be gh-ost-able to enable gh-ost mode.
- const tasks = flattenTaskV1List(issue.value.rolloutEntity);
if (isCreating.value) {
- // When an issue is pending create, we should show the gh-ost section
- // whenever gh-ost is on or off.
- return (
- tasks.some((task) => {
- const database = databaseForTask(issue.value, task);
- return allowGhostForDatabase(database);
- }) &&
- tasks.every((task) => ghostViewTypeForTask(issue.value, task) !== "NONE")
- );
+ return allowGhostForTask(issue.value, selectedTask.value);
} else {
- return viewType.value === "ON";
+ return viewType.value !== "NONE";
}
});
const hasOnlineMigrationFeature = featureToRef("bb.feature.online-migration");
const instance = computed(() => {
- return databaseForTask(issue.value, task.value).instanceResource;
+ return databaseForTask(issue.value, selectedTask.value).instanceResource;
});
</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue
index 32103ac1ca..11be5e2baf 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue
@@ -28,36 +28,36 @@
/>
</template>
-<script setup lang="ts">
+<script setup lang="tsx">
import { NSwitch, NTooltip } from "naive-ui";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import InstanceAssignment from "@/components/InstanceAssignment.vue";
-import { useIssueContext } from "@/components/IssueV1/logic";
+import {
+ databaseForTask,
+ specForTask,
+ useIssueContext,
+} from "@/components/IssueV1/logic";
import type { ErrorItem } from "@/components/misc/ErrorList.vue";
import { default as ErrorList } from "@/components/misc/ErrorList.vue";
import { hasFeature } from "@/store";
import { Engine } from "@/types/proto/v1/common";
+import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
+import { engineNameV1, hasWorkspacePermissionV2 } from "@/utils";
import {
+ allowGhostForTask,
MIN_GHOST_SUPPORT_MARIADB_VERSION,
MIN_GHOST_SUPPORT_MYSQL_VERSION,
- engineNameV1,
- flattenTaskV1List,
- hasWorkspacePermissionV2,
-} from "@/utils";
-import { allowGhostForTask, useIssueGhostContext } from "./common";
+ useIssueGhostContext,
+} from "./common";
const { t } = useI18n();
-const { isCreating, issue, events } = useIssueContext();
-const { viewType, toggleGhost, showFeatureModal, showMissingInstanceLicense } =
+const { isCreating, issue, events, selectedTask } = useIssueContext();
+const { viewType, showFeatureModal, showMissingInstanceLicense } =
useIssueGhostContext();
const isUpdating = ref(false);
const showInstanceAssignmentDrawer = ref(false);
-const allowChange = computed(() => {
- return isCreating.value;
-});
-
const checked = computed(() => {
return viewType.value === "ON";
});
@@ -66,11 +66,6 @@ const canManageSubscription = computed((): boolean => {
return hasWorkspacePermissionV2("bb.settings.set");
});
-const allowGhostForEveryDatabase = computed(() => {
- const tasks = flattenTaskV1List(issue.value.rolloutEntity);
- return tasks.every((task) => allowGhostForTask(issue.value, task));
-});
-
const errors = computed(() => {
const errors: ErrorItem[] = [];
if (showMissingInstanceLicense.value && !canManageSubscription.value) {
@@ -81,10 +76,23 @@ const errors = computed(() => {
t("subscription.instance-assignment.missing-license-attention")
);
}
- if (!allowGhostForEveryDatabase.value) {
+ const database = databaseForTask(issue.value, selectedTask.value);
+ // As we use the same database from backup to save temp tables in gh-ost, check if backup is available.
+ if (!database.backupAvailable) {
+ errors.push(
+ t(
+ "task.online-migration.error.not-applicable.needs-database-for-saving-temp-tables",
+ {
+ // The same database name as backup.
+ database: "bbdataarchive",
+ }
+ )
+ );
+ }
+ if (!allowGhostForTask(issue.value, selectedTask.value)) {
errors.push(
t(
- "task.online-migration.error.not-applicable.some-tasks-dont-meet-ghost-requirement"
+ "task.online-migration.error.not-applicable.task-doesnt-meet-ghost-requirement"
)
);
errors.push({
@@ -95,6 +103,17 @@ const errors = computed(() => {
return errors;
});
+const allowChange = computed(() => {
+ if (errors.value.length > 0) {
+ return false;
+ }
+ if (isCreating.value) {
+ return true;
+ }
+ // We don't support changing task type yet.
+ return false;
+});
+
const toggleChecked = async (on: boolean) => {
if (!hasFeature("bb.feature.online-migration")) {
showFeatureModal.value = true;
@@ -109,13 +128,15 @@ const toggleChecked = async (on: boolean) => {
if (errors.value.length > 0) {
return;
}
-
- isUpdating.value = true;
- try {
- await toggleGhost(on);
- } finally {
- isUpdating.value = false;
+ if (!isCreating.value) {
+ return;
}
+
+ const spec = specForTask(issue.value.planEntity, selectedTask.value);
+ if (!spec || !spec.changeDatabaseConfig) return;
+ spec.changeDatabaseConfig.type = on
+ ? Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
+ : Plan_ChangeDatabaseConfig_Type.MIGRATE;
};
events.on("toggle-online-migration", ({ on }) => {
diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts
index a92d0bdabb..d007ffe12b 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts
+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/common.ts
@@ -29,8 +29,6 @@ import {
task_StatusToJSON,
} from "@/types/proto/v1/rollout_service";
import {
- MIN_GHOST_SUPPORT_MARIADB_VERSION,
- MIN_GHOST_SUPPORT_MYSQL_VERSION,
extractUserResourceName,
flattenTaskV1List,
getSheetStatement,
@@ -38,6 +36,10 @@ import {
semverCompare,
} from "@/utils";
+export const MIN_GHOST_SUPPORT_MYSQL_VERSION = "5.6.0";
+
+export const MIN_GHOST_SUPPORT_MARIADB_VERSION = "10.6.0";
+
export type GhostUIViewType = "NONE" | "OFF" | "ON";
export type IssueGhostContext = {
@@ -167,15 +169,6 @@ export const allowChangeTaskGhostFlags = (issue: ComposedIssue, task: Task) => {
};
export const allowGhostForDatabase = (database: ComposedDatabase) => {
- if (
- !useSubscriptionV1Store().hasInstanceFeature(
- "bb.feature.online-migration",
- database.instanceResource
- )
- ) {
- return false;
- }
-
return (
(database.instanceResource.engine === Engine.MYSQL &&
semverCompare(
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
index b9c1a2a630..1f158ba046 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
@@ -31,6 +31,12 @@
>
<ExternalLinkIcon :size="16" />
</router-link>
+ <NTooltip v-if="showGhostTag">
+ <template #trigger>
+ <NTag size="small" round type="primary">gh-ost</NTag>
+ </template>
+ <span>{{ $t("task.online-migration.self") }}</span>
+ </NTooltip>
<NTag v-if="schemaVersion" size="small" round>
{{ schemaVersion }}
</NTag>
@@ -57,16 +63,17 @@
<script setup lang="ts">
import { ExternalLinkIcon } from "lucide-vue-next";
-import { NTag } from "naive-ui";
+import { NTag, NTooltip } from "naive-ui";
import { twMerge } from "tailwind-merge";
import { computed } from "vue";
import { InstanceV1Name } from "@/components/v2";
import { isValidDatabaseName } from "@/types";
+import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
import { Workflow } from "@/types/proto/v1/project_service";
import { Task } from "@/types/proto/v1/rollout_service";
import { Task_Type, task_StatusToJSON } from "@/types/proto/v1/rollout_service";
import { databaseV1Url, extractSchemaVersionFromTask, isDev } from "@/utils";
-import { databaseForTask, useIssueContext } from "../../logic";
+import { databaseForTask, specForTask, useIssueContext } from "../../logic";
import TaskStatusIcon from "../TaskStatusIcon.vue";
import TaskExtraActionsButton from "./TaskExtraActionsButton.vue";
@@ -81,12 +88,7 @@ const project = computed(() => issue.value.projectEntity);
const selected = computed(() => props.task === selectedTask.value);
const secondaryViewMode = computed((): SecondaryViewMode => {
- if (
- [
- Task_Type.DATABASE_CREATE,
- Task_Type.DATABASE_SCHEMA_UPDATE_GHOST,
- ].includes(props.task.type)
- ) {
+ if ([Task_Type.DATABASE_CREATE].includes(props.task.type)) {
return "TASK_TITLE";
}
return "INSTANCE";
@@ -110,6 +112,16 @@ const schemaVersion = computed(() => {
return v;
});
+const showGhostTag = computed(() => {
+ if (isCreating.value) {
+ return (
+ specForTask(issue.value.planEntity, props.task)?.changeDatabaseConfig
+ ?.type === Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
+ );
+ }
+ return props.task.type === Task_Type.DATABASE_SCHEMA_UPDATE_GHOST;
+});
+
const taskClass = computed(() => {
const { task } = props;
const classes: string[] = [];
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
index d88706d088..0f030b8dcd 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
@@ -14,27 +14,10 @@ import { rolloutServiceClient } from "@/grpcweb";
import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
import TaskRunTable from "./TaskRunTable.vue";
-type ViewMode = "SINGLE" | "MERGED";
-
-const { issue, selectedTask, isGhostMode } = useIssueContext();
-
-/**
- * MERGED mode: merge all tasks' activities into one table
- * SINGLE mode: show only selected task's activities
- */
-const mode = computed((): ViewMode => {
- if (isGhostMode.value) return "MERGED";
- return "SINGLE";
-});
+const { issue, selectedTask } = useIssueContext();
const flattenTaskRunList = computed(() => {
- if (mode.value === "SINGLE") {
- return taskRunListForTask(issue.value, selectedTask.value);
- }
- if (mode.value === "MERGED") {
- return issue.value.rolloutTaskRunList;
- }
- return [];
+ return taskRunListForTask(issue.value, selectedTask.value);
});
watchEffect(async () => {
diff --git a/frontend/src/components/IssueV1/logic/base.ts b/frontend/src/components/IssueV1/logic/base.ts
index d7126f0ccc..086b0dbdfd 100644
--- a/frontend/src/components/IssueV1/logic/base.ts
+++ b/frontend/src/components/IssueV1/logic/base.ts
@@ -7,7 +7,7 @@ import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useUIStateStore } from "@/store";
import { emptyStage, emptyTask } from "@/types";
import type { PlanCheckRun } from "@/types/proto/v1/plan_service";
-import { Task_Type, Stage, Task } from "@/types/proto/v1/rollout_service";
+import { Stage, Task } from "@/types/proto/v1/rollout_service";
import {
activeStageInRollout,
activeTaskInStageV1,
@@ -145,11 +145,6 @@ export const useBaseIssueContext = (
return reviewContext.done.value ? "ROLLOUT" : "REVIEW";
});
- const isGhostMode = computed(() => {
- return flattenTaskV1List(rollout.value).some((task) => {
- return [Task_Type.DATABASE_SCHEMA_UPDATE_GHOST].includes(task.type);
- });
- });
const isLegacyIssue = computed(() => {
return !issue.value.plan && !issue.value.planEntity;
});
@@ -183,7 +178,6 @@ export const useBaseIssueContext = (
return {
phase,
- isGhostMode,
isLegacyIssue,
events,
releaserCandidates,
diff --git a/frontend/src/components/IssueV1/logic/context.ts b/frontend/src/components/IssueV1/logic/context.ts
index 47129b5298..0cb63702ef 100644
--- a/frontend/src/components/IssueV1/logic/context.ts
+++ b/frontend/src/components/IssueV1/logic/context.ts
@@ -46,7 +46,6 @@ export type IssueContext = {
ready: Ref<boolean>;
issue: Ref<ComposedIssue>;
phase: Ref<IssuePhase>;
- isGhostMode: Ref<boolean>;
isLegacyIssue: Ref<boolean>;
releaserCandidates: Ref<User[]>;
allowEditIssue: ComputedRef<boolean>;
diff --git a/frontend/src/components/IssueV1/logic/initialize/create.ts b/frontend/src/components/IssueV1/logic/initialize/create.ts
index 5558b7fd31..c4a068e954 100644
--- a/frontend/src/components/IssueV1/logic/initialize/create.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/create.ts
@@ -329,10 +329,7 @@ export const buildSpecForTarget = async (
}
}
if (template === "bb.issue.database.schema.update") {
- const type =
- query.ghost === "1"
- ? Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
- : Plan_ChangeDatabaseConfig_Type.MIGRATE;
+ const type = Plan_ChangeDatabaseConfig_Type.MIGRATE;
spec.changeDatabaseConfig = Plan_ChangeDatabaseConfig.fromJSON({
target,
type,
diff --git a/frontend/src/components/Plan/logic/initialize/create.ts b/frontend/src/components/Plan/logic/initialize/create.ts
index 6b79c1426c..d0147bdae8 100644
--- a/frontend/src/components/Plan/logic/initialize/create.ts
+++ b/frontend/src/components/Plan/logic/initialize/create.ts
@@ -268,10 +268,7 @@ export const buildSpecForTarget = async (
}
}
if (template === "bb.issue.database.schema.update") {
- const type =
- query.ghost === "1"
- ? Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
- : Plan_ChangeDatabaseConfig_Type.MIGRATE;
+ const type = Plan_ChangeDatabaseConfig_Type.MIGRATE;
spec.changeDatabaseConfig = Plan_ChangeDatabaseConfig.fromJSON({
target,
type,
diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
index 023075b3ce..d836ca6b5e 100644
--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
@@ -6,7 +6,7 @@
container-class="!pt-0 -mt-px"
@close="onClose"
>
- <div class="w-full flex flex-row gap-2">
+ <div class="w-full flex flex-row gap-2 mb-2">
<NTag round v-if="riskLevelText">
<span class="text-gray-400 text-sm mr-1">{{
$t("issue.risk-level.self")
diff --git a/frontend/src/components/SyncDatabaseSchemaV1/index.vue b/frontend/src/components/SyncDatabaseSchemaV1/index.vue
index 3c2795bad7..5657bb2f3c 100644
--- a/frontend/src/components/SyncDatabaseSchemaV1/index.vue
+++ b/frontend/src/components/SyncDatabaseSchemaV1/index.vue
@@ -297,7 +297,6 @@ const tryFinishSetup = async () => {
const query: Record<string, any> = {
template: "bb.issue.database.schema.update",
mode: "normal",
- ghost: undefined,
};
const sqlMap: Record<string, string> = {};
targetDatabaseList.forEach((db) => {
diff --git a/frontend/src/components/misc/ErrorList.vue b/frontend/src/components/misc/ErrorList.vue
index b06d88cf7d..148098ca9c 100644
--- a/frontend/src/components/misc/ErrorList.vue
+++ b/frontend/src/components/misc/ErrorList.vue
@@ -5,20 +5,27 @@
>
<li v-for="(item, i) in errors" :key="i" :style="itemStyle(item)">
<slot name="prefix" />
-
- {{ itemText(item) }}
+ <component v-if="isJSXElement(itemText(item))" :is="itemText(item)" />
+ <span v-else>{{ itemText(item) }}</span>
</li>
</ul>
</template>
-<script setup lang="ts">
+<script setup lang="tsx">
import { computed } from "vue";
+import { isVNode } from "vue";
+import type { JSX } from "vue/jsx-runtime";
export type NestedError = {
- error: string;
+ error: string | JSX.Element;
indent: number;
};
-export type ErrorItem = string | NestedError;
+
+export type ErrorItem = string | JSX.Element | NestedError;
+
+const isJSXElement = (item: any): item is JSX.Element => {
+ return isVNode(item);
+};
const props = withDefaults(
defineProps<{
@@ -36,21 +43,23 @@ const showBullets = computed(() => {
return props.errors.length > 1;
case "always":
return true;
- case "none":
+ default:
return false;
}
- console.error("should never reach this line");
- return false;
});
const itemStyle = (item: ErrorItem) => {
if (typeof item === "string") {
return "";
}
- return `margin-left: ${item.indent}rem;`;
+ if ("indent" in item) {
+ return `margin-left: ${item.indent}rem;`;
+ }
+ return "";
};
+
const itemText = (item: ErrorItem) => {
- if (typeof item === "string") {
+ if (typeof item === "string" || isJSXElement(item)) {
return item;
}
return item.error;
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
index 9eb912c376..3bd457b390 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
@@ -296,8 +296,7 @@ const generateMultiDb = async (
template: type,
name: generateIssueTitle(
type,
- props.databases.map((db) => db.databaseName),
- false
+ props.databases.map((db) => db.databaseName)
),
databaseList: props.databases.map((db) => db.name).join(","),
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 7fe7f9b107..79848808f8 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -286,11 +286,10 @@
"x-status-task-is-not-editable": "{status} task is not editable",
"nothing-changed": "Nothing changed",
"not-applicable": {
- "some-tasks-dont-meet-ghost-requirement": "Some tasks don't meet gh-ost's requirement"
+ "task-doesnt-meet-ghost-requirement": "Task doesn't meet gh-ost's requirement",
+ "needs-database-for-saving-temp-tables": "Needs database({database}) for saving temporary tables."
}
},
- "enable": "Enable online migration",
- "disable": "Disable online migration",
"advice-split-statement-to-single-online-migration-issue": "Advice splitting this statement to single online migration issue."
},
"prior-backup-tips": "Backup affected data ahead of time"
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 5d77a0f9e6..2fc459130a 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -286,11 +286,10 @@
"x-status-task-is-not-editable": "La tarea {status} no es editable",
"nothing-changed": "nada ha cambiado",
"not-applicable": {
- "some-tasks-dont-meet-ghost-requirement": "Algunas tareas no cumplen con los requisitos de gh-ost."
+ "task-doesnt-meet-ghost-requirement": "La tarea no cumple con el requisito de gh-ost",
+ "needs-database-for-saving-temp-tables": "Necesita la base de datos ({database}) para guardar tablas temporales."
}
},
- "enable": "Habilitar la migración en línea",
- "disable": "Deshabilitar la migración en línea",
"advice-split-statement-to-single-online-migration-issue": "Se recomienda dividir esta declaración en un único problema de migración en línea."
},
"prior-backup-tips": "Haga una copia de seguridad de los datos afectados con anticipación"
@@ -2719,4 +2718,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index b417dbe709..0b7ea9f32b 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -286,11 +286,10 @@
"x-status-task-is-not-editable": "{status} のタスクは編集できません",
"nothing-changed": "変化なし",
"not-applicable": {
- "some-tasks-dont-meet-ghost-requirement": "一部のタスクは gh-ost の要件を満たしていません"
+ "task-doesnt-meet-ghost-requirement": "タスクは gh-ost の要件を満たしていません",
+ "needs-database-for-saving-temp-tables": "一時テーブルを保存するにはデータベース({database})が必要です。"
}
},
- "enable": "オンラインでの大規模なテーブル変更を有効にする",
- "disable": "オンライン移行を無効にする",
"advice-split-statement-to-single-online-migration-issue": "このステートメントを 1 つのオンライン移行の問題に分割することをアドバイスします。"
},
"prior-backup-tips": "影響を受けるデータを事前にバックアップする"
@@ -2719,4 +2718,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 25cb1b6b66..58d6c1076e 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -286,11 +286,10 @@
"x-status-task-is-not-editable": "Tác vụ trạng thái {status} không thể chỉnh sửa",
"nothing-changed": "Không có gì thay đổi",
"not-applicable": {
- "some-tasks-dont-meet-ghost-requirement": "Một số tác vụ không đáp ứng yêu cầu gh-ost"
+ "task-doesnt-meet-ghost-requirement": "Nhiệm vụ không đáp ứng được yêu cầu của gh-ost",
+ "needs-database-for-saving-temp-tables": "Cần có cơ sở dữ liệu ({database}) để lưu các bảng tạm thời."
}
},
- "enable": "Bật di chuyển trực tuyến",
- "disable": "Tắt di chuyển trực tuyến",
"advice-split-statement-to-single-online-migration-issue": "Đề nghị chia câu lệnh này thành một vấn đề di chuyển trực tuyến."
},
"prior-backup-tips": "Sao lưu dữ liệu bị ảnh hưởng trước"
@@ -2719,4 +2718,4 @@
"last-visit": "Lần truy cập cuối",
"changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index f014c0bf75..adac64ff75 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -286,11 +286,10 @@
"x-status-task-is-not-editable": "{status} 的任务不可编辑",
"nothing-changed": "无任何改变",
"not-applicable": {
- "some-tasks-dont-meet-ghost-requirement": "部分任务不符合 gh-ost 的要求"
+ "task-doesnt-meet-ghost-requirement": "任务不符合 gh-ost 的要求",
+ "needs-database-for-saving-temp-tables": "需要数据库({database})来保存临时表。"
}
},
- "enable": "启用在线大表变更",
- "disable": "关闭在线大表变更",
"advice-split-statement-to-single-online-migration-issue": "建议将该语句拆分成单独的在线大表变更工单。"
},
"prior-backup-tips": "提前备份受影响的数据"
@@ -2719,4 +2718,4 @@
"last-visit": "上次访问",
"changelog-for-version": "{version} 的更新日志"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/utils/v1/database.ts b/frontend/src/utils/v1/database.ts
index 5f94eb4441..e36a02957f 100644
--- a/frontend/src/utils/v1/database.ts
+++ b/frontend/src/utils/v1/database.ts
@@ -1,5 +1,4 @@
import { orderBy } from "lodash-es";
-import { allowGhostForDatabase } from "@/components/IssueV1/components/Sidebar/GhostSection/common";
import { checkQuerierPermission, hasFeature } from "@/store";
import {
databaseNamePrefix,
@@ -142,13 +141,3 @@ export function filterDatabaseV1ByKeyword(
return false;
}
-
-export const MIN_GHOST_SUPPORT_MYSQL_VERSION = "5.6.0";
-
-export const MIN_GHOST_SUPPORT_MARIADB_VERSION = "10.6.0";
-
-export function allowGhostMigrationV1(
- databaseList: ComposedDatabase[]
-): boolean {
- return databaseList.every((db) => allowGhostForDatabase(db));
-}
diff --git a/frontend/src/utils/v1/issue/issue.ts b/frontend/src/utils/v1/issue/issue.ts
index bdffe14eaf..c6ecc22ea6 100644
--- a/frontend/src/utils/v1/issue/issue.ts
+++ b/frontend/src/utils/v1/issue/issue.ts
@@ -65,8 +65,7 @@ export const generateIssueTitle = (
| "bb.issue.database.data.export"
| "bb.issue.grant.request.querier"
| "bb.issue.grant.request.exporter",
- databaseNameList: string[],
- isOnlineMode = false
+ databaseNameList: string[]
) => {
// Create a user friendly default issue name
const parts: string[] = [];
@@ -78,17 +77,13 @@ export const generateIssueTitle = (
parts.push(`[${databaseNameList.length} databases]`);
}
if (type.startsWith("bb.issue.database")) {
- if (isOnlineMode) {
- parts.push("Online schema change");
- } else {
- parts.push(
- type === "bb.issue.database.schema.update"
- ? t("issue.title.edit-schema")
- : type === "bb.issue.database.data.update"
- ? t("issue.title.change-data")
- : t("issue.title.export-data")
- );
- }
+ parts.push(
+ type === "bb.issue.database.schema.update"
+ ? t("issue.title.edit-schema")
+ : type === "bb.issue.database.data.update"
+ ? t("issue.title.change-data")
+ : t("issue.title.export-data")
+ );
} else {
parts.push(
type === "bb.issue.grant.request.querier"