Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/utils/importSQL/mariadb.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
field.increment = false;
if (d.auto_increment) field.increment = true;
field.notNull = false;
if (d.nullable) field.notNull = true;
// `nullable` is a node for BOTH markers: `NULL` gives
// { type: "null" } and `NOT NULL` gives { type: "not null" },
// so testing it for truthiness marked an explicitly nullable
// column as NOT NULL. Only an omitted marker is undefined.
if (d.nullable && d.nullable.type !== "null") {
field.notNull = true;
}
field.primary = false;
if (d.primary_key) field.primary = true;
field.default = "";
Expand Down
8 changes: 7 additions & 1 deletion src/utils/importSQL/mssql.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) {
field.increment = false;
if (d.auto_increment) field.increment = true;
field.notNull = false;
if (d.nullable) field.notNull = true;
// `nullable` is a node for BOTH markers: `NULL` gives
// { type: "null" } and `NOT NULL` gives { type: "not null" },
// so testing it for truthiness marked an explicitly nullable
// column as NOT NULL. Only an omitted marker is undefined.
if (d.nullable && d.nullable.type !== "null") {
field.notNull = true;
}
field.primary = false;
if (d.primary_key) field.primary = true;
field.default = "";
Expand Down
8 changes: 7 additions & 1 deletion src/utils/importSQL/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
field.increment = false;
if (d.auto_increment) field.increment = true;
field.notNull = false;
if (d.nullable) field.notNull = true;
// `nullable` is a node for BOTH markers: `NULL` gives
// { type: "null" } and `NOT NULL` gives { type: "not null" },
// so testing it for truthiness marked an explicitly nullable
// column as NOT NULL. Only an omitted marker is undefined.
if (d.nullable && d.nullable.type !== "null") {
field.notNull = true;
}
field.primary = false;
if (d.primary_key) field.primary = true;
field.default = "";
Expand Down
8 changes: 7 additions & 1 deletion src/utils/importSQL/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
field.increment = false;
if (d.auto_increment) field.increment = true;
field.notNull = false;
if (d.nullable) field.notNull = true;
// `nullable` is a node for BOTH markers: `NULL` gives
// { type: "null" } and `NOT NULL` gives { type: "not null" },
// so testing it for truthiness marked an explicitly nullable
// column as NOT NULL. Only an omitted marker is undefined.
if (d.nullable && d.nullable.type !== "null") {
field.notNull = true;
}
field.primary = false;
if (d.primary_key) field.primary = true;
field.default = "";
Expand Down
8 changes: 7 additions & 1 deletion src/utils/importSQL/sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ export function fromSQLite(ast, diagramDb = DB.GENERIC) {
field.increment = false;
if (d.auto_increment) field.increment = true;
field.notNull = false;
if (d.nullable) field.notNull = true;
// `nullable` is a node for BOTH markers: `NULL` gives
// { type: "null" } and `NOT NULL` gives { type: "not null" },
// so testing it for truthiness marked an explicitly nullable
// column as NOT NULL. Only an omitted marker is undefined.
if (d.nullable && d.nullable.type !== "null") {
field.notNull = true;
}
field.primary = false;
if (d.primary_key) field.primary = true;
field.default = "";
Expand Down
Loading