@aceitadev/adatabase 0.5.9 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SchemaManager.js +5 -5
- package/package.json +1 -1
package/dist/SchemaManager.js
CHANGED
|
@@ -58,7 +58,7 @@ class SchemaManager {
|
|
|
58
58
|
const isLastChange = changeIndex === changes.length - 1;
|
|
59
59
|
const changeLinePrefix = isLastTable ? " " : "│ ";
|
|
60
60
|
const changeConnector = isLastChange ? "└─" : "├─";
|
|
61
|
-
console.log(`${changeLinePrefix}
|
|
61
|
+
console.log(`${changeLinePrefix}${changeConnector} ${change}`);
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -110,10 +110,8 @@ class SchemaManager {
|
|
|
110
110
|
tableChanges.push(`+ ${col} (adicionado)`);
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
|
-
// Função de normalização aprimorada para ignorar diferenças irrelevantes
|
|
114
113
|
const normalize = (t) => {
|
|
115
114
|
let normalized = t.toLowerCase().replace(/\s/g, '').replace('character varying', 'varchar');
|
|
116
|
-
// Remove o comprimento de exibição de tipos inteiros, ex: int(11) -> int
|
|
117
115
|
normalized = normalized.replace(/^(int|integer|tinyint|smallint|mediumint|bigint)\(\d+\)/, '$1');
|
|
118
116
|
return normalized;
|
|
119
117
|
};
|
|
@@ -168,10 +166,12 @@ class SchemaManager {
|
|
|
168
166
|
let sqlType = this.getSqlTypeForClass(type);
|
|
169
167
|
if (type === Number && opts.decimal) {
|
|
170
168
|
if (Array.isArray(opts.decimal) && opts.decimal.length === 2) {
|
|
171
|
-
|
|
169
|
+
// CORREÇÃO: Removido o espaço após a vírgula
|
|
170
|
+
sqlType = `DECIMAL(${opts.decimal[0]},${opts.decimal[1]})`;
|
|
172
171
|
}
|
|
173
172
|
else {
|
|
174
|
-
|
|
173
|
+
// CORREÇÃO: Removido o espaço após a vírgula
|
|
174
|
+
sqlType = 'DECIMAL(10,2)';
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
else if (type === String && (opts === null || opts === void 0 ? void 0 : opts.limit)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aceitadev/adatabase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Uma biblioteca para facilitar a interação com bancos de dados MySQL e PostgreSQL em projetos TypeScript/Node.js.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|