This commit is contained in:
Tben 2023-08-25 10:02:01 +01:00
parent 71ef33c241
commit 614aabd20e
2 changed files with 5 additions and 5 deletions

View File

@ -354,7 +354,7 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
updateText += `MODIFY COLUMN ${fieldEntryText}`; updateText += `MODIFY COLUMN ${fieldEntryText}`;
// continue; // continue;
} else { } else {
updateText += `MODIFY COLUMN ${fieldEntryText}${isColumnReordered ? (prevColumn?.fieldName ? " AFTER `" + prevColumn.fieldName + "`" : nextColumn?.fieldName ? " BEFORE `" + nextColumn.fieldName + "`" : "") : ""}`; updateText += `MODIFY COLUMN ${fieldEntryText}${isColumnReordered ? (prevColumn?.fieldName ? " AFTER `" + prevColumn.fieldName + "`" : " AFTER `id`") : ""}`;
// if (userId) { // if (userId) {
// } else { // } else {
// updateText += `MODIFY COLUMN ${fieldEntryText}`; // updateText += `MODIFY COLUMN ${fieldEntryText}`;
@ -366,12 +366,12 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
* previous column exists * previous column exists
*/ */
updateText += `ADD COLUMN ${fieldEntryText} AFTER \`${prevColumn.fieldName}\``; updateText += `ADD COLUMN ${fieldEntryText} AFTER \`${prevColumn.fieldName}\``;
} else if (nextColumn && nextColumn.fieldName) { } else if (!prevColumn && nextColumn && nextColumn.fieldName) {
/** /**
* @description Add new Column BEFORE next column, if * @description Add new Column before next column, if
* next column exists * next column exists
*/ */
updateText += `ADD COLUMN ${fieldEntryText} BEFORE \`${nextColumn.fieldName}\``; updateText += `ADD COLUMN ${fieldEntryText} AFTER \`id\``;
} else { } else {
/** /**
* @description Append new column to the end of existing columns * @description Append new column to the end of existing columns

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.8.5", "version": "1.8.6",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {