Skip to content

Commit

Permalink
Parse default casting
Browse files Browse the repository at this point in the history
  • Loading branch information
1ilit committed Nov 3, 2024
1 parent 9a9df56 commit 28ec12b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/importSQL/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
}
} else if (d.default_val.value.type === "null") {
defaultValue = "NULL";
} else if (d.default_val.value.type === "cast") {
defaultValue = d.default_val.value.expr.value;
} else {
defaultValue = d.default_val.value.value.toString();
}
Expand Down Expand Up @@ -278,7 +280,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
e.expr.forEach((expr) => {
if (
expr.action === "add" &&
expr.create_definitions.constraint_type.toLowerCase() === "foreign key"
expr.create_definitions.constraint_type.toLowerCase() ===
"foreign key"
) {
const relationship = {};
const startTable = e.table[0].table;
Expand Down

0 comments on commit 28ec12b

Please sign in to comment.