mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 17:06:01 +00:00
utility functions, trat view as table
This commit is contained in:
@@ -4,7 +4,13 @@ import _ from 'lodash';
|
||||
import axios from '../utility/axios';
|
||||
import engines from '@dbgate/engines';
|
||||
|
||||
import { useConnectionInfo, getTableInfo, getConnectionInfo, getSqlObjectInfo } from '../utility/metadataLoaders';
|
||||
import {
|
||||
useConnectionInfo,
|
||||
getTableInfo,
|
||||
getDbCore,
|
||||
getConnectionInfo,
|
||||
getSqlObjectInfo,
|
||||
} from '../utility/metadataLoaders';
|
||||
import SqlEditor from '../sqleditor/SqlEditor';
|
||||
import { useUpdateDatabaseForTab, useSetOpenedTabs, useOpenedTabs } from '../utility/globalState';
|
||||
import QueryToolbar from '../query/QueryToolbar';
|
||||
@@ -24,7 +30,7 @@ function useSqlTemplate(sqlTemplate, props) {
|
||||
|
||||
async function loadTemplate() {
|
||||
if (sqlTemplate == 'CREATE TABLE') {
|
||||
const tableInfo = await getTableInfo(props);
|
||||
const tableInfo = await getDbCore(props, props.objectTypeField || 'tables');
|
||||
const connection = await getConnectionInfo(props);
|
||||
const driver = engines(connection.engine);
|
||||
const dmp = driver.createDumper();
|
||||
|
||||
@@ -5,7 +5,7 @@ import ObjectListControl from '../utility/ObjectListControl';
|
||||
import { TableColumn } from '../utility/TableControl';
|
||||
import columnAppObject from '../appobj/columnAppObject';
|
||||
import constraintAppObject from '../appobj/constraintAppObject';
|
||||
import { useTableInfo } from '../utility/metadataLoaders';
|
||||
import { useTableInfo, useDbCore } from '../utility/metadataLoaders';
|
||||
|
||||
const WhitePage = styled.div`
|
||||
position: absolute;
|
||||
@@ -16,8 +16,8 @@ const WhitePage = styled.div`
|
||||
background-color: white;
|
||||
`;
|
||||
|
||||
export default function TableStructureTab({ conid, database, schemaName, pureName }) {
|
||||
const tableInfo = useTableInfo({ conid, database, schemaName, pureName });
|
||||
export default function TableStructureTab({ conid, database, schemaName, pureName, objectTypeField = 'tables' }) {
|
||||
const tableInfo = useDbCore({ conid, database, schemaName, pureName, objectTypeField });
|
||||
if (!tableInfo) return null;
|
||||
const { columns, primaryKey, foreignKeys, dependencies } = tableInfo;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user