Skip to content

Commit 5c1b292

Browse files
authored
Fix oracle export and default sizes (#386)
1 parent 16ea2ee commit 5c1b292

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/data/datatypes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ const oraclesqlTypesBase = {
18561856
hasCheck: true,
18571857
isSized: true,
18581858
hasPrecision: false,
1859-
defaultSize: 4000,
1859+
defaultSize: 255,
18601860
hasQuotes: true,
18611861
},
18621862
NVARCHAR2: {
@@ -1870,7 +1870,7 @@ const oraclesqlTypesBase = {
18701870
hasCheck: true,
18711871
isSized: true,
18721872
hasPrecision: false,
1873-
defaultSize: 4000,
1873+
defaultSize: 255,
18741874
hasQuotes: true,
18751875
},
18761876
CHAR: {
@@ -2008,7 +2008,7 @@ const oraclesqlTypesBase = {
20082008
hasCheck: false,
20092009
isSized: true,
20102010
hasPrecision: false,
2011-
defaultSize: 2000,
2011+
defaultSize: 255,
20122012
hasQuotes: false,
20132013
},
20142014
};

src/utils/exportSQL/oraclesql.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { dbToTypes } from "../../data/datatypes";
22
import { parseDefault } from "./shared";
33

44
export function toOracleSQL(diagram) {
5+
console.log(diagram);
56
return `${diagram.tables
67
.map(
78
(table) =>
@@ -12,9 +13,11 @@ export function toOracleSQL(diagram) {
1213
(field) =>
1314
`${field.comment === "" ? "" : `\t-- ${field.comment}\n`}\t"${
1415
field.name
15-
}" ${field.type}${field.size && Boolean(field.size.trim()) ? "(" + field.size + ")" : ""}${
16-
field.notNull ? " NOT NULL" : ""
17-
}${
16+
}" ${field.type}${
17+
field.size !== undefined && field.size !== ""
18+
? "(" + field.size + ")"
19+
: ""
20+
}${field.notNull ? " NOT NULL" : ""}${
1821
field.increment ? " GENERATED ALWAYS AS IDENTITY" : ""
1922
}${field.unique ? " UNIQUE" : ""}${
2023
field.default !== ""

0 commit comments

Comments
 (0)