fix(schema): handle view DDL object types
This commit is contained in:
1 parent
7643148708
commit
22b8ba17bb
14 files changed
+175
-48
No files matched your search
@@ -728,7 +728,7 @@ async function confirmBatchDropTables() {
|
||||
async function exportStructure(row: ObjectBrowserRow) {
|
||||
try {
|
||||
const schema = row.schema || selectedSchema.value || props.database;
|
||||
const ddl = await api.getTableDdl(props.connection.id, props.database, schema, row.name);
|
||||
const ddl = await api.getTableDdl(props.connection.id, props.database, schema, row.name, row.type === "VIEW" ? "VIEW" : undefined);
|
||||
await saveFileContent(ddl + "\n", `${row.name}.sql`, "SQL", "sql");
|
||||
} catch (e: any) {
|
||||
console.error("Export structure failed:", e);
|
||||
|
||||
@@ -2096,7 +2096,7 @@ async function exportStructure() {
|
||||
const parts: string[] = [];
|
||||
for (const target of targets) {
|
||||
await connectionStore.ensureConnected(target.connectionId);
|
||||
const ddl = await api.getTableDdl(target.connectionId, target.database, target.schema || target.database, target.label);
|
||||
const ddl = await api.getTableDdl(target.connectionId, target.database, target.schema || target.database, target.label, target.type === "view" ? "VIEW" : undefined);
|
||||
parts.push(ddl.trim());
|
||||
}
|
||||
structurePreviewSql.value = `${parts.filter(Boolean).join("\n\n")}\n`;
|
||||
|
||||
Reference in new issue
Block a user