This commit is contained in:
2026-01-14 11:01:08 +01:00
parent 0a03405598
commit b50e100732
8 changed files with 91 additions and 20 deletions
+22
View File
@@ -13,6 +13,7 @@ import handleTableForeignKey from "./handle-table-foreign-key";
import handleDSQLSchemaFields from "./handle-dsql-schema-fields";
import handleMariaDBExistingColumns from "./handle-mariadb-existing-columns";
import updateTableInit from "./update-table-init";
import debugLog from "../../utils/logging/debug-log";
type Param = {
dbFullName: string;
@@ -62,6 +63,11 @@ export default async function updateTable({
* @description Try to undate table, catch error if anything goes wrong
*/
try {
debugLog({
log: `Handling Existing Columns ...`,
addTime: true,
});
const { allExistingColumns, upToDateTableFieldsArray } =
await handleMariaDBExistingColumns({
dbFullName,
@@ -77,6 +83,10 @@ export default async function updateTable({
* @description Iterate through each field object and
* perform operations
*/
debugLog({
log: `Handling Schema Fields ...`,
addTime: true,
});
await handleDSQLSchemaFields({
dbFullName,
tableName,
@@ -90,6 +100,10 @@ export default async function updateTable({
* @description Iterate through each datasquirel schema
* table index(if available), and perform operations
*/
debugLog({
log: `Handling Table Foreign Keys ...`,
addTime: true,
});
await handleTableForeignKey({
dbFullName,
fields: upToDateTableFieldsArray,
@@ -103,6 +117,10 @@ export default async function updateTable({
* @description Iterate through each datasquirel schema
* table index(if available), and perform operations
*/
debugLog({
log: `Handling Table Indexes ...`,
addTime: true,
});
if (tableIndexes?.[0]) {
handleIndexescreateDbFromSchema({
dbFullName,
@@ -117,6 +135,10 @@ export default async function updateTable({
* @description Iterate through each datasquirel schema
* table unique constraint(if available), and perform operations
*/
debugLog({
log: `Handling Unique Constraints ...`,
addTime: true,
});
if (tableUniqueConstraints?.[0]) {
handleUniqueConstraintsCreateDbFromSchema({
dbFullName,