mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-02-11 02:00:37 +08:00
Set up multiple imports for generic diagrams
This commit is contained in:
19
src/utils/importSQL/index.js
Normal file
19
src/utils/importSQL/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { DB } from "../../data/constants";
|
||||
import { fromMySQL } from "./mysql";
|
||||
|
||||
export function importSQL(ast, database = DB.MYSQL) {
|
||||
switch (database) {
|
||||
case DB.SQLITE:
|
||||
return { tables: [], relationships: [] };
|
||||
case DB.MYSQL:
|
||||
return fromMySQL(ast);
|
||||
case DB.POSTGRES:
|
||||
return { tables: [], relationships: [] };
|
||||
case DB.MARIADB:
|
||||
return { tables: [], relationships: [] };
|
||||
case DB.MSSQL:
|
||||
return { tables: [], relationships: [] };
|
||||
default:
|
||||
return { tables: [], relationships: [] };
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
tableColorStripHeight,
|
||||
tableFieldHeight,
|
||||
tableHeaderHeight,
|
||||
} from "../data/constants";
|
||||
} from "../../data/constants";
|
||||
|
||||
function buildSQLFromAST(ast) {
|
||||
if (ast.type === "binary_expr") {
|
||||
@@ -41,7 +41,7 @@ function buildSQLFromAST(ast) {
|
||||
}
|
||||
}
|
||||
|
||||
export function astToDiagram(ast) {
|
||||
export function fromMySQL(ast) {
|
||||
const tables = [];
|
||||
const relationships = [];
|
||||
|
||||
Reference in New Issue
Block a user