Bugfix
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ function createTable(_a) {
|
||||
})();
|
||||
createTableQueryArray.push(" " + fieldEntryText + comma);
|
||||
}
|
||||
createTableQueryArray.push(`) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;`);
|
||||
createTableQueryArray.push(`) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=${(tableSchema === null || tableSchema === void 0 ? void 0 : tableSchema.collation) || "utf8mb4_bin"};`);
|
||||
const createTableQuery = createTableQueryArray.join("\n");
|
||||
const newTable = yield (0, dbHandler_1.default)({
|
||||
query: createTableQuery,
|
||||
|
||||
+20
@@ -63,6 +63,26 @@ function updateTable(_a) {
|
||||
if (!tableID && !isMain) {
|
||||
throw new Error("Recorded Table entry not found!");
|
||||
}
|
||||
/**
|
||||
* Handle Table Default Collation
|
||||
*
|
||||
* @description Update Column Collation
|
||||
*/
|
||||
if (tableSchema.collation) {
|
||||
try {
|
||||
const existingCollation = (yield (0, dbHandler_1.default)({
|
||||
query: `SHOW TABLE STATUS LIKE '${tableName}'`,
|
||||
config: { database: dbFullName },
|
||||
}));
|
||||
const existingCollationStr = existingCollation === null || existingCollation === void 0 ? void 0 : existingCollation[0].Collation;
|
||||
if (existingCollationStr !== tableSchema.collation) {
|
||||
yield (0, dbHandler_1.default)({
|
||||
query: `ALTER TABLE \`${dbFullName}\`.\`${tableName}\` CONVERT TO CHARACTER SET utf8mb4 COLLATE ${tableSchema.collation}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
/**
|
||||
* Handle Table updates
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user