fix(diff): sync MySQL comment differences
This commit is contained in:
1 parent
ad9b7e5908
commit
ca0153acbb
7 files changed
+152
-19
No files matched your search
@@ -54,6 +54,7 @@ const executedCount = ref(0);
|
||||
const executeTotal = ref(0);
|
||||
const syncErrors = ref<{ sql: string; error: string }[]>([]);
|
||||
const syncSql = ref("");
|
||||
const ignoreComments = ref(false);
|
||||
const highlightedSyncSql = computed(() => highlight(syncSql.value));
|
||||
|
||||
const allSelected = computed(() => diffs.value.length > 0 && diffs.value.every((d) => d.selected));
|
||||
@@ -185,6 +186,7 @@ async function startCompare() {
|
||||
targetDetails,
|
||||
databaseType: targetConfig?.db_type || "mysql",
|
||||
targetSchema: targetSchema.value,
|
||||
ignoreComments: ignoreComments.value,
|
||||
});
|
||||
|
||||
diffs.value = result.diffs.map((diff) => ({ ...diff, selected: true }));
|
||||
@@ -346,6 +348,7 @@ watch(targetDatabase, (database) => {
|
||||
});
|
||||
watch(sourceSchema, () => resetResult());
|
||||
watch(targetSchema, () => resetResult());
|
||||
watch(ignoreComments, () => resetResult());
|
||||
|
||||
watch(
|
||||
open,
|
||||
@@ -495,6 +498,13 @@ watch(
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 rounded-md border bg-muted/20 px-3 py-2">
|
||||
<input id="schema-diff-ignore-comments" v-model="ignoreComments" type="checkbox" class="accent-primary" />
|
||||
<Label for="schema-diff-ignore-comments" class="cursor-pointer text-xs">
|
||||
{{ t("diff.ignoreComments") }}
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
<!-- Comparing -->
|
||||
<div v-if="step === 'comparing'" class="flex items-center justify-center py-8 text-sm text-muted-foreground">
|
||||
<Loader2 class="w-4 h-4 animate-spin mr-2" />
|
||||
@@ -604,6 +614,13 @@ watch(
|
||||
<span v-if="ti < d.triggers!.length - 1">, </span>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="d.type === 'modified' && d.sourceTableComment !== undefined">
|
||||
<span
|
||||
v-if="d.columns?.length || d.indexes?.length || d.foreignKeys?.length || d.triggers?.length"
|
||||
>;
|
||||
</span>
|
||||
<span>{{ t("diff.comments") }}</span>
|
||||
</template>
|
||||
<span v-else-if="d.type === 'added'" class="text-green-500">{{ t("diff.newTable") }}</span>
|
||||
<span v-else-if="d.type === 'removed'" class="text-red-500">{{ t("diff.dropTable") }}</span>
|
||||
</td>
|
||||
|
||||
Reference in new issue
Block a user