mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-07-18 10:11:24 +00:00
Include field size in mssql export (#488)
This commit is contained in:
@@ -36,7 +36,7 @@ export function toMSSQL(diagram) {
|
|||||||
const fieldsSql = table.fields
|
const fieldsSql = table.fields
|
||||||
.map(
|
.map(
|
||||||
(field) =>
|
(field) =>
|
||||||
`\t[${field.name}] ${field.type}${
|
`\t[${field.name}] ${field.type}${field.size && `(${field.size})`}${
|
||||||
field.notNull ? " NOT NULL" : ""
|
field.notNull ? " NOT NULL" : ""
|
||||||
}${field.increment ? " IDENTITY" : ""}${
|
}${field.increment ? " IDENTITY" : ""}${
|
||||||
field.unique ? " UNIQUE" : ""
|
field.unique ? " UNIQUE" : ""
|
||||||
@@ -61,9 +61,7 @@ export function toMSSQL(diagram) {
|
|||||||
.join(", ")})`
|
.join(", ")})`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
const createTableSql = `CREATE TABLE [${
|
const createTableSql = `CREATE TABLE [${table.name}] (\n${fieldsSql}${primaryKeySql}\n);\nGO\n`;
|
||||||
table.name
|
|
||||||
}] (\n${fieldsSql}${primaryKeySql}\n);\nGO\n`;
|
|
||||||
|
|
||||||
const tableCommentSql = generateAddExtendedPropertySQL(
|
const tableCommentSql = generateAddExtendedPropertySQL(
|
||||||
table.comment,
|
table.comment,
|
||||||
@@ -98,9 +96,7 @@ export function toMSSQL(diagram) {
|
|||||||
|
|
||||||
if (!startTable || !endTable) return "";
|
if (!startTable || !endTable) return "";
|
||||||
|
|
||||||
const startField = startTable.fields.find(
|
const startField = startTable.fields.find((f) => f.id === r.startFieldId);
|
||||||
(f) => f.id === r.startFieldId,
|
|
||||||
);
|
|
||||||
const endField = endTable.fields.find((f) => f.id === r.endFieldId);
|
const endField = endTable.fields.find((f) => f.id === r.endFieldId);
|
||||||
|
|
||||||
if (!startField || !endField) return "";
|
if (!startField || !endField) return "";
|
||||||
|
Reference in New Issue
Block a user