This commit is contained in:
Benjamin Toby 2026-01-11 06:21:48 +01:00
parent 18a9409aec
commit 0a03405598
6 changed files with 19 additions and 9 deletions

View File

@ -27,14 +27,14 @@ function generateTypeDefinition({ paradigm, table, query, typeDefName, allValues
})
.join(" | ");
}
if ((_a = schemaType.dataType) === null || _a === void 0 ? void 0 : _a.match(/int/i)) {
if ((_a = schemaType.dataType) === null || _a === void 0 ? void 0 : _a.match(/int|double|decimal/i)) {
return "number";
}
if ((_b = schemaType.dataType) === null || _b === void 0 ? void 0 : _b.match(/text|varchar|timestamp/i)) {
return "string";
}
if ((_c = schemaType.dataType) === null || _c === void 0 ? void 0 : _c.match(/boolean/i)) {
return "boolean";
return "0 | 1";
}
return "string";
}

View File

@ -89,8 +89,12 @@ function default_1(_a) {
tableId = newTableEntryRes.postInsertReturn.insertId;
}
}
if (newTableSchema.tableNameOld) {
}
// if (newTableSchema.tableNameOld) {
// const renameTable = await dbHandler({
// query: `RENAME TABLE \`${targetDatabase}\`.\`${newTableSchema.tableNameOld}\` TO \`${targetDatabase}\`.\`${newTableSchema.tableName}\``,
// noErrorLogs: true,
// });
// }
return tableId;
}
catch (error) {

View File

@ -42,7 +42,8 @@ export default function generateTypeDefinition({
)
.join(" | ");
}
if (schemaType.dataType?.match(/int/i)) {
if (schemaType.dataType?.match(/int|double|decimal/i)) {
return "number";
}
@ -51,7 +52,7 @@ export default function generateTypeDefinition({
}
if (schemaType.dataType?.match(/boolean/i)) {
return "boolean";
return "0 | 1";
}
return "string";

View File

@ -113,6 +113,7 @@ export default async function createDbFromSchema({
console.log(
`Dropping Table ${TABLE_NAME} from ${dbFullName}`
);
await dbHandler({
query: `DROP TABLE \`${dbFullName}\`.\`${TABLE_NAME}\``,
});

View File

@ -102,8 +102,12 @@ export default async function ({
}
}
if (newTableSchema.tableNameOld) {
}
// if (newTableSchema.tableNameOld) {
// const renameTable = await dbHandler({
// query: `RENAME TABLE \`${targetDatabase}\`.\`${newTableSchema.tableNameOld}\` TO \`${targetDatabase}\`.\`${newTableSchema.tableName}\``,
// noErrorLogs: true,
// });
// }
return tableId;
} catch (error) {

View File

@ -1,6 +1,6 @@
{
"name": "@moduletrace/datasquirel",
"version": "5.7.26",
"version": "5.7.27",
"description": "Cloud-based SQL data management tool",
"main": "dist/index.js",
"bin": {