Fix oracle export and default sizes (#386)

This commit is contained in:
1ilit 2025-04-02 20:49:30 +04:00 committed by GitHub
parent 16ea2ee23c
commit 5c1b2928d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -1856,7 +1856,7 @@ const oraclesqlTypesBase = {
hasCheck: true, hasCheck: true,
isSized: true, isSized: true,
hasPrecision: false, hasPrecision: false,
defaultSize: 4000, defaultSize: 255,
hasQuotes: true, hasQuotes: true,
}, },
NVARCHAR2: { NVARCHAR2: {
@ -1870,7 +1870,7 @@ const oraclesqlTypesBase = {
hasCheck: true, hasCheck: true,
isSized: true, isSized: true,
hasPrecision: false, hasPrecision: false,
defaultSize: 4000, defaultSize: 255,
hasQuotes: true, hasQuotes: true,
}, },
CHAR: { CHAR: {
@ -2008,7 +2008,7 @@ const oraclesqlTypesBase = {
hasCheck: false, hasCheck: false,
isSized: true, isSized: true,
hasPrecision: false, hasPrecision: false,
defaultSize: 2000, defaultSize: 255,
hasQuotes: false, hasQuotes: false,
}, },
}; };

View File

@ -2,6 +2,7 @@ import { dbToTypes } from "../../data/datatypes";
import { parseDefault } from "./shared"; import { parseDefault } from "./shared";
export function toOracleSQL(diagram) { export function toOracleSQL(diagram) {
console.log(diagram);
return `${diagram.tables return `${diagram.tables
.map( .map(
(table) => (table) =>
@ -12,9 +13,11 @@ export function toOracleSQL(diagram) {
(field) => (field) =>
`${field.comment === "" ? "" : `\t-- ${field.comment}\n`}\t"${ `${field.comment === "" ? "" : `\t-- ${field.comment}\n`}\t"${
field.name field.name
}" ${field.type}${field.size && Boolean(field.size.trim()) ? "(" + field.size + ")" : ""}${ }" ${field.type}${
field.notNull ? " NOT NULL" : "" field.size !== undefined && field.size !== ""
}${ ? "(" + field.size + ")"
: ""
}${field.notNull ? " NOT NULL" : ""}${
field.increment ? " GENERATED ALWAYS AS IDENTITY" : "" field.increment ? " GENERATED ALWAYS AS IDENTITY" : ""
}${field.unique ? " UNIQUE" : ""}${ }${field.unique ? " UNIQUE" : ""}${
field.default !== "" field.default !== ""