mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-10-13 13:58:05 +00:00
Fix import and export failing on non string column defaults for oracle (#637)
This commit is contained in:
@@ -13,7 +13,7 @@ export const tableSchema = {
|
||||
id: { type: ["integer", "string"] },
|
||||
name: { type: "string" },
|
||||
type: { type: "string" },
|
||||
default: { type: "string" },
|
||||
default: { type: ["string", "number", "boolean"] },
|
||||
check: { type: "string" },
|
||||
primary: { type: "boolean" },
|
||||
unique: { type: "boolean" },
|
||||
@@ -55,10 +55,10 @@ export const tableSchema = {
|
||||
},
|
||||
},
|
||||
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" },
|
||||
},
|
||||
inherits: {
|
||||
type: "array",
|
||||
items: { type: ["string"] },
|
||||
inherits: {
|
||||
type: "array",
|
||||
items: { type: ["string"] },
|
||||
},
|
||||
},
|
||||
required: ["id", "name", "x", "y", "fields", "comment", "indices", "color"],
|
||||
};
|
||||
|
@@ -5,7 +5,12 @@ import { isFunction } from "./utils";
|
||||
function checkDefault(field, database) {
|
||||
if (field.default === "") return true;
|
||||
if (isFunction(field.default)) return true;
|
||||
if (!field.notNull && field.default.toLowerCase() === "null") return true;
|
||||
if (
|
||||
!field.notNull &&
|
||||
typeof field === "string" &&
|
||||
field.default.toLowerCase() === "null"
|
||||
)
|
||||
return true;
|
||||
if (!dbToTypes[database][field.type].checkDefault) return true;
|
||||
|
||||
return dbToTypes[database][field.type].checkDefault(field);
|
||||
@@ -67,7 +72,11 @@ export function getIssues(diagram) {
|
||||
);
|
||||
}
|
||||
|
||||
if (field.notNull && field.default.toLowerCase() === "null") {
|
||||
if (
|
||||
field.notNull &&
|
||||
typeof field.default === "string" &&
|
||||
field.default.toLowerCase() === "null"
|
||||
) {
|
||||
issues.push(
|
||||
i18n.t("not_null_is_null", {
|
||||
tableName: table.name,
|
||||
|
@@ -41,10 +41,12 @@ const keywords = [
|
||||
"CURRENT_TIME",
|
||||
"CURRENT_TIMESTAMP",
|
||||
"LOCALTIME",
|
||||
"LOCALTIMESTAMP"
|
||||
"LOCALTIMESTAMP",
|
||||
];
|
||||
|
||||
export function isKeyword(str) {
|
||||
if (typeof str !== "string") return false;
|
||||
|
||||
return keywords.includes(str.toUpperCase());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user