diff --git a/src/components/EditorSidePanel/TablesTab/FieldDetails.jsx b/src/components/EditorSidePanel/TablesTab/FieldDetails.jsx
index 46d41df..ae574ba 100644
--- a/src/components/EditorSidePanel/TablesTab/FieldDetails.jsx
+++ b/src/components/EditorSidePanel/TablesTab/FieldDetails.jsx
@@ -123,9 +123,9 @@ export default function FieldDetails({ data, tid, index }) {
Precision
{
- e.id = i;
- e.fields.forEach((f, j) => {
- f.id = j;
- });
+ table.fields.forEach((f, j) => {
+ f.id = j;
});
+ table.id = tables.length;
+ tables.push(table);
} else if (e.keyword === "index") {
const index = {};
index.name = e.index;
diff --git a/src/utils/toSQL.js b/src/utils/toSQL.js
index 4720a6e..28bb4db 100644
--- a/src/utils/toSQL.js
+++ b/src/utils/toSQL.js
@@ -44,10 +44,7 @@ export function getTypeString(field, dbms = "mysql", baseType = false) {
if (field.type === "UUID") {
return `VARCHAR(36)`;
}
- if (isSized(field.type)) {
- return `${field.type}(${field.size})`;
- }
- if (hasPrecision(field.type)) {
+ if (hasPrecision(field.type) || isSized(field.type)) {
return `${field.type}${field.size ? `(${field.size})` : ""}`;
}
if (field.type === "SET" || field.type === "ENUM") {