feat(query): add DDL shortcut to result toolbar
This commit is contained in:
5 files changed
+105
-12
No files matched your search
@@ -491,6 +491,7 @@ interface DataGridProps {
|
|||||||
autoTransposeSingleRow?: boolean;
|
autoTransposeSingleRow?: boolean;
|
||||||
sourceColumns?: Array<string | undefined>;
|
sourceColumns?: Array<string | undefined>;
|
||||||
joinedWriteTargets?: import("@/types/database").QueryTab["queryWriteTargets"];
|
joinedWriteTargets?: import("@/types/database").QueryTab["queryWriteTargets"];
|
||||||
|
queryMultiSource?: boolean;
|
||||||
readonlyColumnIndexes?: number[];
|
readonlyColumnIndexes?: number[];
|
||||||
/**
|
/**
|
||||||
* Column comments for a multi-source query result (e.g. JOIN), indexed by
|
* Column comments for a multi-source query result (e.g. JOIN), indexed by
|
||||||
@@ -11356,6 +11357,13 @@ function toggleCellDetailPanelLayout() {
|
|||||||
|
|
||||||
const tableMetadataCapabilities = computed(() => getTableMetadataCapabilities(resolvedDatabaseType.value));
|
const tableMetadataCapabilities = computed(() => getTableMetadataCapabilities(resolvedDatabaseType.value));
|
||||||
const canOpenTableStructureEditor = computed(() => !!props.connectionId && !!props.database && !!props.tableMeta?.tableName && supportsTableStructureEditing(resolvedDatabaseType.value));
|
const canOpenTableStructureEditor = computed(() => !!props.connectionId && !!props.database && !!props.tableMeta?.tableName && supportsTableStructureEditing(resolvedDatabaseType.value));
|
||||||
|
const tableInfoToolbarCapability = computed<DataGridToolbarActionCapability>(() => ({
|
||||||
|
label: "DDL",
|
||||||
|
tooltip: t("contextMenu.viewDdl"),
|
||||||
|
visible: props.context === "results" && !props.queryMultiSource && !!props.connectionId && !!(props.tableMeta?.database || props.database) && !!props.tableMeta?.tableName && tableMetadataCapabilities.value.ddl,
|
||||||
|
active: showTableInfo.value && activeTableInfoTab.value === "ddl",
|
||||||
|
onTrigger: () => toggleTableInfo("ddl"),
|
||||||
|
}));
|
||||||
const mongoConnectionConfig = resolvedConnectionConfig;
|
const mongoConnectionConfig = resolvedConnectionConfig;
|
||||||
const canManageMongoIndexes = computed(() => resolvedDatabaseType.value === "mongodb" && !!props.connectionId && !!props.database && !!props.tableMeta?.tableName && supportsMongoIndexMutations(mongoConnectionConfig.value, props.tableMeta?.tableType));
|
const canManageMongoIndexes = computed(() => resolvedDatabaseType.value === "mongodb" && !!props.connectionId && !!props.database && !!props.tableMeta?.tableName && supportsMongoIndexMutations(mongoConnectionConfig.value, props.tableMeta?.tableType));
|
||||||
const canShowTableIndexes = computed(() => tableMetadataCapabilities.value.indexes && (resolvedDatabaseType.value !== "mongodb" || mongoCollectionSupportsIndexes(props.tableMeta?.tableType)));
|
const canShowTableIndexes = computed(() => tableMetadataCapabilities.value.indexes && (resolvedDatabaseType.value !== "mongodb" || mongoCollectionSupportsIndexes(props.tableMeta?.tableType)));
|
||||||
@@ -11560,7 +11568,7 @@ async function selectTableInfoTab(tab: TableInfoTab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.tableInfoTab, props.connectionId, props.database, props.tableMeta?.catalog, props.tableMeta?.schema, props.tableMeta?.tableName] as const,
|
() => [props.tableInfoTab, props.connectionId, props.database, props.tableMeta?.database, props.tableMeta?.catalog, props.tableMeta?.schema, props.tableMeta?.tableName] as const,
|
||||||
([tab]) => {
|
([tab]) => {
|
||||||
if (tab) void selectTableInfoTab(tab);
|
if (tab) void selectTableInfoTab(tab);
|
||||||
},
|
},
|
||||||
@@ -11605,7 +11613,7 @@ async function refreshActiveTableInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.connectionId, props.database, props.tableMeta?.catalog, props.tableMeta?.schema, props.tableMeta?.tableName],
|
() => [props.connectionId, props.database, props.tableMeta?.database, props.tableMeta?.catalog, props.tableMeta?.schema, props.tableMeta?.tableName],
|
||||||
() => {
|
() => {
|
||||||
tableInfoColumns.value = props.tableMeta?.columns ?? [];
|
tableInfoColumns.value = props.tableMeta?.columns ?? [];
|
||||||
tableInfoColumnsLoading.value = false;
|
tableInfoColumnsLoading.value = false;
|
||||||
@@ -12288,6 +12296,7 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
tableInfoToolbarCapability,
|
||||||
useTransaction,
|
useTransaction,
|
||||||
transactionActive,
|
transactionActive,
|
||||||
isSaving,
|
isSaving,
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ function actionLabelClass(action: DataGridToolbarActionKey) {
|
|||||||
size="sm"
|
size="sm"
|
||||||
:class="[...actionButtonClass('tableInfo'), tableInfo?.active ? 'bg-primary/10 text-primary hover:bg-primary/15' : '']"
|
:class="[...actionButtonClass('tableInfo'), tableInfo?.active ? 'bg-primary/10 text-primary hover:bg-primary/15' : '']"
|
||||||
:disabled="isDataGridToolbarCapabilityDisabled(tableInfo)"
|
:disabled="isDataGridToolbarCapabilityDisabled(tableInfo)"
|
||||||
|
:aria-label="tableInfo?.tooltip ?? tableInfo?.label"
|
||||||
:aria-pressed="tableInfo?.active"
|
:aria-pressed="tableInfo?.active"
|
||||||
@click="void triggerDataGridToolbarAction(tableInfo)"
|
@click="void triggerDataGridToolbarAction(tableInfo)"
|
||||||
>
|
>
|
||||||
|
|||||||
+67
-8
@@ -1,11 +1,17 @@
|
|||||||
// @vitest-environment happy-dom
|
// @vitest-environment happy-dom
|
||||||
|
|
||||||
import { createApp, defineComponent, h, markRaw, nextTick, type App, type PropType } from "vue";
|
import { createApp, defineComponent, h, markRaw, nextTick, ref, type App, type PropType } from "vue";
|
||||||
import { createPinia, setActivePinia } from "pinia";
|
import { createPinia, setActivePinia } from "pinia";
|
||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import i18n from "@/i18n";
|
import i18n from "@/i18n";
|
||||||
import type { QueryResult } from "@/types/database";
|
import type { DatabaseType, QueryResult } from "@/types/database";
|
||||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||||
|
import type { DataGridToolbarActionCapability } from "@/lib/dataGrid/dataGridToolbar";
|
||||||
|
import { loadObjectDdl } from "@/lib/metadata/objectDdlCache";
|
||||||
|
|
||||||
|
vi.mock("@/lib/metadata/objectDdlCache", () => ({
|
||||||
|
loadObjectDdl: vi.fn(async () => ({ ddl: "CREATE TABLE users (id INT);", cacheStatus: "remote" })),
|
||||||
|
}));
|
||||||
|
|
||||||
vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => {
|
vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => {
|
||||||
const actual = await importOriginal<typeof import("@/composables/useDataGridColumnResize")>();
|
const actual = await importOriginal<typeof import("@/composables/useDataGridColumnResize")>();
|
||||||
@@ -46,7 +52,19 @@ const RecycleScroller = defineComponent({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function mountGrid(options: { displayableColumns?: boolean; columns?: string[]; slots?: Record<string, () => ReturnType<typeof h>>; withTableMetadata?: boolean } = {}) {
|
function mountGrid(
|
||||||
|
options: {
|
||||||
|
displayableColumns?: boolean;
|
||||||
|
columns?: string[];
|
||||||
|
slots?: Record<string, () => ReturnType<typeof h>>;
|
||||||
|
withTableMetadata?: boolean;
|
||||||
|
context?: "table-data" | "results";
|
||||||
|
queryMultiSource?: boolean;
|
||||||
|
databaseType?: DatabaseType;
|
||||||
|
sourceDatabase?: string;
|
||||||
|
joinedWriteTargetCount?: number;
|
||||||
|
} = {},
|
||||||
|
) {
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
setActivePinia(pinia);
|
setActivePinia(pinia);
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
@@ -65,6 +83,7 @@ function mountGrid(options: { displayableColumns?: boolean; columns?: string[];
|
|||||||
hidden_column_indexes: options.displayableColumns === false ? [0] : undefined,
|
hidden_column_indexes: options.displayableColumns === false ? [0] : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const grid = ref<{ tableInfoToolbarCapability: DataGridToolbarActionCapability }>();
|
||||||
const host = document.createElement("div");
|
const host = document.createElement("div");
|
||||||
document.body.append(host);
|
document.body.append(host);
|
||||||
const Root = defineComponent({
|
const Root = defineComponent({
|
||||||
@@ -78,14 +97,17 @@ function mountGrid(options: { displayableColumns?: boolean; columns?: string[];
|
|||||||
h(
|
h(
|
||||||
DataGrid,
|
DataGrid,
|
||||||
{
|
{
|
||||||
|
ref: grid,
|
||||||
result,
|
result,
|
||||||
databaseType: "mysql",
|
databaseType: options.databaseType ?? "mysql",
|
||||||
context: "table-data",
|
context: options.context ?? "table-data",
|
||||||
|
queryMultiSource: options.queryMultiSource,
|
||||||
|
joinedWriteTargets: options.joinedWriteTargetCount ? Array.from({ length: options.joinedWriteTargetCount }, (_, index) => ({ tableMeta: { tableName: `table_${index}`, columns: [], primaryKeys: [] }, sourceColumns: ["id"] })) : undefined,
|
||||||
...(options.withTableMetadata
|
...(options.withTableMetadata
|
||||||
? {
|
? {
|
||||||
connectionId: "test-connection",
|
connectionId: "test-connection",
|
||||||
database: "test-database",
|
database: "test-database",
|
||||||
tableMeta: { tableName: "users", schema: "test-database", columns: [], primaryKeys: [] },
|
tableMeta: { tableName: "users", database: options.sourceDatabase, schema: options.databaseType === "sqlserver" ? "dbo" : "test-database", columns: [], primaryKeys: [] },
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
},
|
},
|
||||||
@@ -102,7 +124,7 @@ function mountGrid(options: { displayableColumns?: boolean; columns?: string[];
|
|||||||
app.mount(host);
|
app.mount(host);
|
||||||
const mounted = { app, host };
|
const mounted = { app, host };
|
||||||
mountedApps.push(mounted);
|
mountedApps.push(mounted);
|
||||||
return { ...mounted, settingsStore };
|
return { ...mounted, settingsStore, grid };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function settle() {
|
async function settle() {
|
||||||
@@ -136,6 +158,7 @@ function goToColumnEvent(target: HTMLElement): KeyboardEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
for (const { app, host } of mountedApps.splice(0)) {
|
for (const { app, host } of mountedApps.splice(0)) {
|
||||||
app.unmount();
|
app.unmount();
|
||||||
@@ -172,13 +195,49 @@ describe("DataGrid go-to-column shortcut", () => {
|
|||||||
expect(host.querySelector('[data-grid-topbar-row="filters"].data-grid-topbar-scroll--row-divider')).not.toBeNull();
|
expect(host.querySelector('[data-grid-topbar-row="filters"].data-grid-topbar-scroll--row-divider')).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not show a DDL action in the result action toolbar", async () => {
|
it("does not duplicate the DDL action in the table-data toolbar", async () => {
|
||||||
const { host } = mountGrid({ withTableMetadata: true });
|
const { host } = mountGrid({ withTableMetadata: true });
|
||||||
await settle();
|
await settle();
|
||||||
|
|
||||||
expect(host.querySelector('[data-toolbar-action="tableInfo"]')).toBeNull();
|
expect(host.querySelector('[data-toolbar-action="tableInfo"]')).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("shows a DDL action for query results with table metadata", async () => {
|
||||||
|
const { host, grid } = mountGrid({ withTableMetadata: true, context: "results" });
|
||||||
|
await settle();
|
||||||
|
|
||||||
|
expect(grid.value?.tableInfoToolbarCapability.visible).toBe(true);
|
||||||
|
expect(grid.value?.tableInfoToolbarCapability.label).toBe("DDL");
|
||||||
|
expect(host.querySelector('[data-toolbar-action="tableInfo"]')).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([1, 2])("hides DDL for a multi-source query with %i writable targets", async (joinedWriteTargetCount) => {
|
||||||
|
const { grid } = mountGrid({ withTableMetadata: true, context: "results", queryMultiSource: true, joinedWriteTargetCount });
|
||||||
|
await settle();
|
||||||
|
expect(grid.value?.tableInfoToolbarCapability.visible).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
{ withTableMetadata: false, databaseType: "mysql" as const },
|
||||||
|
{ withTableMetadata: true, databaseType: "mongodb" as const },
|
||||||
|
])("hides DDL without a supported source: %j", async (options) => {
|
||||||
|
const { grid } = mountGrid({ ...options, context: "results" });
|
||||||
|
await settle();
|
||||||
|
expect(grid.value?.tableInfoToolbarCapability.visible).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([undefined, "reporting"])("opens DDL using source database %s with execution-database fallback", async (sourceDatabase) => {
|
||||||
|
const { host, settingsStore, grid } = mountGrid({ withTableMetadata: true, context: "results", databaseType: "sqlserver", sourceDatabase });
|
||||||
|
settingsStore.updateEditorSettings({ tableInfoActiveTab: "indexes" });
|
||||||
|
await settle();
|
||||||
|
await grid.value!.tableInfoToolbarCapability.onTrigger();
|
||||||
|
await vi.waitFor(() => {
|
||||||
|
expect(loadObjectDdl).toHaveBeenCalledWith(expect.objectContaining({ connectionId: "test-connection", database: sourceDatabase ?? "test-database", schema: "dbo", tableName: "users" }), expect.anything());
|
||||||
|
expect(host.querySelector("[data-table-info-drawer]")?.textContent).toContain("CREATE TABLE");
|
||||||
|
});
|
||||||
|
expect(grid.value?.tableInfoToolbarCapability.active).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("keeps result actions and query filters in their separate toolbar rows", async () => {
|
it("keeps result actions and query filters in their separate toolbar rows", async () => {
|
||||||
const { host } = mountGrid({
|
const { host } = mountGrid({
|
||||||
slots: {
|
slots: {
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ import { applyMongoGridChangesToDocument, applyMongoGridChangesToDocumentBaselin
|
|||||||
import { buildMongoQueryResultOperations, formatMongoQueryResultOperationPreview } from "@/lib/mongo/mongoQueryResultEditing";
|
import { buildMongoQueryResultOperations, formatMongoQueryResultOperationPreview } from "@/lib/mongo/mongoQueryResultEditing";
|
||||||
import { buildInfluxDbV1DeleteStatements, canDeleteInfluxDbV1Row, resolveInfluxDbV1DeleteTarget } from "@/lib/influxdb/influxDbV1Delete";
|
import { buildInfluxDbV1DeleteStatements, canDeleteInfluxDbV1Row, resolveInfluxDbV1DeleteTarget } from "@/lib/influxdb/influxDbV1Delete";
|
||||||
import type { DataGridSortMode } from "@/lib/dataGrid/dataGridSort";
|
import type { DataGridSortMode } from "@/lib/dataGrid/dataGridSort";
|
||||||
import { isDataGridToolbarCompact, type DataGridReloadIntent } from "@/lib/dataGrid/dataGridToolbar";
|
import { isDataGridToolbarCompact, type DataGridReloadIntent, type DataGridToolbarActionCapability } from "@/lib/dataGrid/dataGridToolbar";
|
||||||
import { useTabScroll } from "@/composables/useTabScroll";
|
import { useTabScroll } from "@/composables/useTabScroll";
|
||||||
import { useToolbarOverflow } from "@/composables/useToolbarOverflow";
|
import { useToolbarOverflow } from "@/composables/useToolbarOverflow";
|
||||||
import { formatElapsedSeconds } from "@/lib/common/elapsedTime";
|
import { formatElapsedSeconds } from "@/lib/common/elapsedTime";
|
||||||
@@ -206,6 +206,7 @@ import { connectionIsEffectivelyReadOnly } from "@/lib/database/readOnlyWriteAcc
|
|||||||
import { isAiRedisConsoleTarget, type AiConversationBinding } from "@/lib/ai/aiConversationBinding";
|
import { isAiRedisConsoleTarget, type AiConversationBinding } from "@/lib/ai/aiConversationBinding";
|
||||||
|
|
||||||
type DataGridHandle = DataGridColumnLayoutHandle & {
|
type DataGridHandle = DataGridColumnLayoutHandle & {
|
||||||
|
tableInfoToolbarCapability: DataGridToolbarActionCapability;
|
||||||
onToolbarRefresh: () => Promise<void> | void;
|
onToolbarRefresh: () => Promise<void> | void;
|
||||||
focusSearch: (target?: Element | null) => boolean;
|
focusSearch: (target?: Element | null) => boolean;
|
||||||
focusWhere: () => boolean;
|
focusWhere: () => boolean;
|
||||||
@@ -2050,6 +2051,24 @@ defineExpose({
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<div class="ml-auto flex shrink-0 items-center gap-1">
|
<div class="ml-auto flex shrink-0 items-center gap-1">
|
||||||
|
<template v-if="activeOutputView === 'result' && redisResultViewMode === 'grid' && activeTab.result && hasTabularResult && !activeElasticsearchJsonResponse && !showElasticsearchRawJson">
|
||||||
|
<DataGridColumnLayoutPopover :grid="dataGridRef" trigger-class="px-1.5" />
|
||||||
|
<LightTooltip v-if="dataGridRef?.tableInfoToolbarCapability?.visible" :text="t('contextMenu.viewDdl')" side="bottom" nowrap>
|
||||||
|
<Button
|
||||||
|
data-query-result-ddl
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
class="h-6 shrink-0 gap-1 px-1.5 text-xs"
|
||||||
|
:class="{ 'bg-accent': dataGridRef.tableInfoToolbarCapability.active }"
|
||||||
|
:aria-label="t('contextMenu.viewDdl')"
|
||||||
|
:aria-pressed="dataGridRef.tableInfoToolbarCapability.active"
|
||||||
|
@click="dataGridRef.tableInfoToolbarCapability.onTrigger()"
|
||||||
|
>
|
||||||
|
<TableProperties class="h-3.5 w-3.5" />
|
||||||
|
DDL
|
||||||
|
</Button>
|
||||||
|
</LightTooltip>
|
||||||
|
</template>
|
||||||
<Popover v-if="activeOutputView === 'result' && redisResultViewMode === 'grid' && activeTab.result && hasTabularResult && !activeElasticsearchJsonResponse" v-model:open="dataGridViewOptionsOpen">
|
<Popover v-if="activeOutputView === 'result' && redisResultViewMode === 'grid' && activeTab.result && hasTabularResult && !activeElasticsearchJsonResponse" v-model:open="dataGridViewOptionsOpen">
|
||||||
<PopoverTrigger as-child>
|
<PopoverTrigger as-child>
|
||||||
<Button variant="ghost" size="icon" class="h-6 w-7 shrink-0 text-foreground hover:bg-accent" :title="t('grid.viewOptions')" :aria-label="t('grid.viewOptions')">
|
<Button variant="ghost" size="icon" class="h-6 w-7 shrink-0 text-foreground hover:bg-accent" :title="t('grid.viewOptions')" :aria-label="t('grid.viewOptions')">
|
||||||
@@ -2517,6 +2536,7 @@ defineExpose({
|
|||||||
:editable="!hasNeo4jNodes && (!!activeTab.queryAnalysis || !!mongoQueryResultSaveHandler)"
|
:editable="!hasNeo4jNodes && (!!activeTab.queryAnalysis || !!mongoQueryResultSaveHandler)"
|
||||||
:source-columns="hasNeo4jNodes ? undefined : activeTab.querySourceColumns"
|
:source-columns="hasNeo4jNodes ? undefined : activeTab.querySourceColumns"
|
||||||
:joined-write-targets="hasNeo4jNodes ? undefined : activeTab.queryWriteTargets"
|
:joined-write-targets="hasNeo4jNodes ? undefined : activeTab.queryWriteTargets"
|
||||||
|
:query-multi-source="(activeTab.queryWriteTargets?.length ?? 0) > 1"
|
||||||
:readonly-column-indexes="hasNeo4jNodes ? undefined : groupedQueryReadonlyColumnIndexes(activeTab)"
|
:readonly-column-indexes="hasNeo4jNodes ? undefined : groupedQueryReadonlyColumnIndexes(activeTab)"
|
||||||
:result-column-comments="hasNeo4jNodes ? undefined : activeTab.resultColumnComments"
|
:result-column-comments="hasNeo4jNodes ? undefined : activeTab.resultColumnComments"
|
||||||
:query-display-source-columns="hasNeo4jNodes ? undefined : activeTab.queryDisplaySourceColumns"
|
:query-display-source-columns="hasNeo4jNodes ? undefined : activeTab.queryDisplaySourceColumns"
|
||||||
@@ -2617,7 +2637,6 @@ defineExpose({
|
|||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template #result-toolbar-actions="{ compact }">
|
<template #result-toolbar-actions="{ compact }">
|
||||||
<DataGridColumnLayoutPopover :grid="dataGridRef" :compact="compact" />
|
|
||||||
<QueryResultToolbarActions
|
<QueryResultToolbarActions
|
||||||
:active-view="activeOutputView"
|
:active-view="activeOutputView"
|
||||||
:can-show-explain="canShowExplainOutput"
|
:can-show-explain="canShowExplainOutput"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ type ConnectionStore = ReturnType<typeof useConnectionStore>;
|
|||||||
interface TableMetadataProps {
|
interface TableMetadataProps {
|
||||||
connectionId?: string;
|
connectionId?: string;
|
||||||
database?: string;
|
database?: string;
|
||||||
|
schema?: string;
|
||||||
context?: "results" | "table-data";
|
context?: "results" | "table-data";
|
||||||
tableInfoTab?: string;
|
tableInfoTab?: string;
|
||||||
autoShowTableInfo?: boolean;
|
autoShowTableInfo?: boolean;
|
||||||
@@ -119,6 +120,10 @@ export function useDataGridTableMetadataLoaders(options: DataGridTableMetadataLo
|
|||||||
async function fetchDdl(force = options.settingsStore.editorSettings.refreshDdlOnOpen) {
|
async function fetchDdl(force = options.settingsStore.editorSettings.refreshDdlOnOpen) {
|
||||||
const request = tableRequest();
|
const request = tableRequest();
|
||||||
if (!request) return;
|
if (!request) return;
|
||||||
|
// Query execution and source-table metadata can belong to different
|
||||||
|
// databases (for example SQL Server three-part table references).
|
||||||
|
request.database = props.tableMeta?.database || request.database;
|
||||||
|
request.schema = props.tableMeta?.schema || props.schema || props.database || "";
|
||||||
options.showTableInfo.value = true;
|
options.showTableInfo.value = true;
|
||||||
state.ddlLoading.value = true;
|
state.ddlLoading.value = true;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in new issue
Block a user