This commit is contained in:
2026-02-19 04:52:04 +01:00
parent 0a1993494d
commit 0da68e30b8
7 changed files with 97 additions and 65 deletions
@@ -23,34 +23,6 @@ const app_data_1 = __importDefault(require("../../data/app-data"));
*/
function handleUniqueConstraintsCreateDbFromSchema(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbFullName, tableName, tableUniqueConstraints, }) {
/**
* # Delete All Existing Unique Constraints
*/
// const allExistingUniqueConstraints = (await dbHandler({
// query: `SHOW INDEXES FROM \`${dbFullName}\`.\`${tableName}\` WHERE Index_comment LIKE '%${AppData["UniqueConstraintComment"]}%'`,
// })) as DSQL_MYSQL_SHOW_INDEXES_Type[] | null;
// if (allExistingUniqueConstraints?.[0]) {
// for (let f = 0; f < allExistingUniqueConstraints.length; f++) {
// const { Key_name } = allExistingUniqueConstraints[f];
// try {
// const existingKeyInSchema = tableUniqueConstraints?.find(
// (indexObject) => indexObject.alias === Key_name
// );
// if (!existingKeyInSchema)
// throw new Error(
// `This Index(${Key_name}) Has been Deleted!`
// );
// } catch (error) {
// /**
// * @description Drop Index: This happens when the MYSQL index is not
// * present in the datasquirel DB schema
// */
// await dbHandler({
// query: `ALTER TABLE \`${dbFullName}\`.\`${tableName}\` DROP INDEX \`${Key_name}\``,
// });
// }
// }
// }
/**
* # Re-Add New Constraints
*/