Bugfix
This commit is contained in:
@@ -287,7 +287,6 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
|
||||
orderFields.push(genObject.order.field);
|
||||
}
|
||||
orderSrt += ` ${orderFields.join(", ")} ${genObject.order.strategy}`;
|
||||
console.log("orderSrt", orderSrt);
|
||||
queryString += ` ${orderSrt}`;
|
||||
}
|
||||
if ((genObject === null || genObject === void 0 ? void 0 : genObject.limit) && !count)
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ function createDbFromSchema(_a) {
|
||||
});
|
||||
if (!((_b = dbCheck === null || dbCheck === void 0 ? void 0 : dbCheck[0]) === null || _b === void 0 ? void 0 : _b.dbFullName)) {
|
||||
const newDatabase = yield (0, dbHandler_1.default)({
|
||||
query: `CREATE DATABASE IF NOT EXISTS \`${dbFullName}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_bin`,
|
||||
query: `CREATE DATABASE IF NOT EXISTS \`${dbFullName}\` CHARACTER SET utf8mb4 COLLATE ${database.collation || "utf8mb4_bin"}`,
|
||||
});
|
||||
}
|
||||
const allTables = (yield (0, dbHandler_1.default)({
|
||||
|
||||
+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
|
||||
*
|
||||
|
||||
Vendored
+2
@@ -101,6 +101,7 @@ export type DSQL_DATASQUIREL_USER_DATABASES = {
|
||||
active_clone_parent_db?: string;
|
||||
active_clone_parent_db_id?: number;
|
||||
active_data?: number;
|
||||
collation?: string;
|
||||
last_checked_date_code?: number;
|
||||
date_created?: string;
|
||||
date_created_code?: number;
|
||||
@@ -124,6 +125,7 @@ export type DSQL_DATASQUIREL_USER_DATABASE_TABLES = {
|
||||
child_table_parent_database_schema_id?: number;
|
||||
child_table_parent_table_schema_id?: number;
|
||||
active_data?: 0 | 1;
|
||||
collation?: string;
|
||||
last_checked_date_code?: number;
|
||||
date_created?: string;
|
||||
date_created_code?: number;
|
||||
|
||||
Vendored
+3
@@ -39,10 +39,12 @@ export interface DSQL_DatabaseSchemaType {
|
||||
childDatabase?: boolean;
|
||||
childDatabaseDbId?: string | number;
|
||||
updateData?: boolean;
|
||||
collation?: (typeof MariaDBCollations)[number];
|
||||
}
|
||||
export interface DSQL_ChildrenDatabaseObject {
|
||||
dbId?: string | number;
|
||||
}
|
||||
export declare const MariaDBCollations: readonly ["utf8mb4_bin", "utf8mb4_unicode_520_ci"];
|
||||
export interface DSQL_TableSchemaType {
|
||||
id?: string | number;
|
||||
tableName: string;
|
||||
@@ -55,6 +57,7 @@ export interface DSQL_TableSchemaType {
|
||||
childTableId?: string | number;
|
||||
tableNameOld?: string;
|
||||
childTableDbId?: string | number;
|
||||
collation?: (typeof MariaDBCollations)[number];
|
||||
}
|
||||
export interface DSQL_ChildrenTablesType {
|
||||
tableId?: string | number;
|
||||
|
||||
Vendored
+5
-1
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AIOptions = exports.OpsActions = exports.TimeParadigms = exports.UserAPIAuthActions = exports.UserAPIParadigms = exports.TargetMediaParadigms = exports.EnvKeys = exports.AppVersions = exports.APIParadigms = exports.UserSQLPermissions = exports.SQLPermissions = exports.InvitedUserSelectFields = exports.DelegatedUserSelectFields = exports.UserSelectFields = exports.IndexTypes = exports.DefaultSQLValuesLiteral = exports.CurrentlyEditedFieldActions = exports.FileMimeTypes = exports.VideoMimeTypes = exports.ImageMimeTypes = exports.MediaTypes = exports.DockerComposeServices = exports.DatasquirelWindowEvents = exports.WebSocketEvents = exports.QueueJobTypes = exports.SignUpParadigms = exports.UserTypes = exports.QueryFields = exports.DsqlCrudActions = exports.DataCrudRequestMethodsLowerCase = exports.DataCrudRequestMethods = exports.ServerQueryEqualities = exports.ServerQueryOperators = exports.TextFieldTypesArray = exports.UsersOmitedFields = void 0;
|
||||
exports.AIOptions = exports.OpsActions = exports.TimeParadigms = exports.UserAPIAuthActions = exports.UserAPIParadigms = exports.TargetMediaParadigms = exports.EnvKeys = exports.AppVersions = exports.APIParadigms = exports.UserSQLPermissions = exports.SQLPermissions = exports.InvitedUserSelectFields = exports.DelegatedUserSelectFields = exports.UserSelectFields = exports.IndexTypes = exports.DefaultSQLValuesLiteral = exports.CurrentlyEditedFieldActions = exports.FileMimeTypes = exports.VideoMimeTypes = exports.ImageMimeTypes = exports.MediaTypes = exports.DockerComposeServices = exports.DatasquirelWindowEvents = exports.WebSocketEvents = exports.QueueJobTypes = exports.SignUpParadigms = exports.UserTypes = exports.QueryFields = exports.DsqlCrudActions = exports.DataCrudRequestMethodsLowerCase = exports.DataCrudRequestMethods = exports.ServerQueryEqualities = exports.ServerQueryOperators = exports.TextFieldTypesArray = exports.MariaDBCollations = exports.UsersOmitedFields = void 0;
|
||||
exports.UsersOmitedFields = [
|
||||
"password",
|
||||
"social_id",
|
||||
@@ -12,6 +12,10 @@ exports.UsersOmitedFields = [
|
||||
"date_updated_code",
|
||||
"date_updated_timestamp",
|
||||
];
|
||||
exports.MariaDBCollations = [
|
||||
"utf8mb4_bin",
|
||||
"utf8mb4_unicode_520_ci",
|
||||
];
|
||||
exports.TextFieldTypesArray = [
|
||||
{ title: "Plain Text", value: "plain" },
|
||||
{ title: "Rich Text", value: "richText" },
|
||||
|
||||
Reference in New Issue
Block a user