Merge branch 'main' into select-db

# Conflicts:
#	src/i18n/locales/en.js
#	src/utils/exportSQL/generic.js
This commit is contained in:
1ilit
2024-07-07 17:57:33 +03:00
13 changed files with 143 additions and 60 deletions

View File

@@ -176,14 +176,14 @@ export function jsonToMySQL(obj) {
: ""
}\n)${table.comment ? ` COMMENT='${table.comment}'` : ""};\n${
table.indices.length > 0
? `\n${table.indices.map(
(i) =>
`\nCREATE ${i.unique ? "UNIQUE " : ""}INDEX \`${
i.name
}\`\nON \`${table.name}\` (${i.fields
.map((f) => `\`${f}\``)
.join(", ")});`,
)}`
? `\n${table.indices
.map(
(i) =>
`CREATE ${i.unique ? "UNIQUE " : ""}INDEX \`${i.name}\`\nON \`${table.name}\` (${i.fields
.map((f) => `\`${f}\``)
.join(", ")});`,
)
.join("\n")}`
: ""
}`,
)
@@ -251,10 +251,8 @@ export function jsonToPostgreSQL(obj) {
field.name
}" ${getTypeString(field, obj.database, "postgres")}${
field.notNull ? " NOT NULL" : ""
}${
field.default !== ""
? ` DEFAULT ${parseDefault(field, obj.database)}`
: ""
}${field.unique ? " UNIQUE" : ""}${
field.default !== "" ? ` DEFAULT ${parseDefault(field)}` : ""
}${
field.check === "" ||
!dbToTypes[obj.database][field.type].hasCheck
@@ -271,14 +269,16 @@ export function jsonToPostgreSQL(obj) {
: ""
}\n);\n${
table.indices.length > 0
? `${table.indices.map(
(i) =>
`\nCREATE ${i.unique ? "UNIQUE " : ""}INDEX "${
i.name
}"\nON "${table.name}" (${i.fields
.map((f) => `"${f}"`)
.join(", ")});`,
)}`
? `${table.indices
.map(
(i) =>
`CREATE ${i.unique ? "UNIQUE " : ""}INDEX "${
i.name
}"\nON "${table.name}" (${i.fields
.map((f) => `"${f}"`)
.join(", ")});`,
)
.join("\n")}`
: ""
}`,
)
@@ -426,14 +426,16 @@ export function jsonToMariaDB(obj) {
: ""
}\n);${
table.indices.length > 0
? `\n${table.indices.map(
(i) =>
`\nCREATE ${i.unique ? "UNIQUE " : ""}INDEX \`${
i.name
}\`\nON \`${table.name}\` (${i.fields
.map((f) => `\`${f}\``)
.join(", ")});`,
)}`
? `\n${table.indices
.map(
(i) =>
`CREATE ${i.unique ? "UNIQUE " : ""}INDEX \`${
i.name
}\`\nON \`${table.name}\` (${i.fields
.map((f) => `\`${f}\``)
.join(", ")});`,
)
.join("\n")}`
: ""
}`,
)

View File

@@ -99,6 +99,13 @@ export function getIssues(diagram) {
});
table.indices.forEach((index) => {
if (index.name.trim() === "") {
issues.push(
i18n.t("empty_index_name", {
tableName: table.name,
}),
);
}
if (index.fields.length === 0) {
issues.push(
i18n.t("empty_index", {

View File

@@ -7,7 +7,7 @@ export const getModalTitle = (modal) => {
case MODAL.IMPORT_SRC:
return i18n.t("import_diagram");
case MODAL.CODE:
return i18n.t("export_source");
return i18n.t("export");
case MODAL.IMG:
return i18n.t("export_image");
case MODAL.RENAME: