Updates
This commit is contained in:
parent
0a1993494d
commit
0da68e30b8
@ -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
|
||||
*/
|
||||
|
||||
3
dist/package-shared/types/dsql.d.ts
vendored
3
dist/package-shared/types/dsql.d.ts
vendored
@ -35,7 +35,7 @@ export type DSQL_DATASQUIREL_API_KEYS = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
key?: string;
|
||||
scope?: "readOnly" | "fullAccess";
|
||||
scope?: "readOnly" | "fullAccess" | "media";
|
||||
all_dbs?: 0 | 1;
|
||||
media_only?: 0 | 1;
|
||||
csrf?: string;
|
||||
@ -373,3 +373,4 @@ export type DSQL_DATASQUIREL_USER_PRIVATE_MEDIA_KEYS = {
|
||||
date_updated_code?: number;
|
||||
date_updated_timestamp?: string;
|
||||
};
|
||||
export type DSQL_DATASQUIREL_ALL_TYPEDEFS = DSQL_DATASQUIREL_USERS & DSQL_DATASQUIREL_API_KEYS & DSQL_DATASQUIREL_API_KEYS_SCOPED_RESOURCES & DSQL_DATASQUIREL_INVITATIONS & DSQL_DATASQUIREL_USER_DATABASES & DSQL_DATASQUIREL_USER_DATABASE_TABLES & DSQL_DATASQUIREL_USER_MEDIA & DSQL_DATASQUIREL_USER_PRIVATE_FOLDERS & DSQL_DATASQUIREL_DELEGATED_USERS & DSQL_DATASQUIREL_DELEGATED_RESOURCES & DSQL_DATASQUIREL_MARIADB_USER_PRIVILEGES & DSQL_DATASQUIREL_UNSUBSCRIBES & DSQL_DATASQUIREL_NOTIFICATIONS & DSQL_DATASQUIREL_DELETED_API_KEYS & DSQL_DATASQUIREL_SERVERS & DSQL_DATASQUIREL_PROCESS_QUEUE & DSQL_DATASQUIREL_BACKUPS & DSQL_DATASQUIREL_MARIADB_USERS & DSQL_DATASQUIREL_MARIADB_USER_DATABASES & DSQL_DATASQUIREL_MARIADB_USER_TABLES & DSQL_DATASQUIREL_USER_PRIVATE_MEDIA_KEYS;
|
||||
|
||||
45
dist/package-shared/types/index.d.ts
vendored
45
dist/package-shared/types/index.d.ts
vendored
@ -54,10 +54,35 @@ export interface DSQL_TableSchemaType {
|
||||
indexes?: DSQL_IndexSchemaType[];
|
||||
uniqueConstraints?: DSQL_UniqueConstraintSchemaType[];
|
||||
childrenTables?: DSQL_ChildrenTablesType[];
|
||||
/**
|
||||
* Whether this is a child table
|
||||
*/
|
||||
childTable?: boolean;
|
||||
updateData?: boolean;
|
||||
/**
|
||||
* ID of the parent table
|
||||
*/
|
||||
childTableId?: string | number;
|
||||
/**
|
||||
* ID of the parent table
|
||||
*/
|
||||
parentTableId?: string | number;
|
||||
/**
|
||||
* ID of the Database of parent table
|
||||
*/
|
||||
parentTableDbId?: string | number;
|
||||
/**
|
||||
* Name of the Database of parent table
|
||||
*/
|
||||
parentTableDbName?: string;
|
||||
/**
|
||||
* Name of the parent table
|
||||
*/
|
||||
parentTableName?: string;
|
||||
tableNameOld?: string;
|
||||
/**
|
||||
* ID of the Database of parent table
|
||||
*/
|
||||
childTableDbId?: string | number;
|
||||
collation?: (typeof MariaDBCollations)[number];
|
||||
isVector?: boolean;
|
||||
@ -839,6 +864,7 @@ export type ApiKeyObject = {
|
||||
sign?: string;
|
||||
date_code?: number;
|
||||
error?: string;
|
||||
media_only?: boolean;
|
||||
};
|
||||
export type AddApiKeyRequestBody = {
|
||||
api_key: DSQL_DATASQUIREL_API_KEYS;
|
||||
@ -1486,7 +1512,7 @@ export type PagePropsType = {
|
||||
mediaCurrentFolder?: string | null;
|
||||
appData?: DsqlAppData | null;
|
||||
staticHost?: string | null;
|
||||
folders?: string[] | null;
|
||||
folders?: LocalFolderType[] | null;
|
||||
activeClonedTable?: boolean | null;
|
||||
tableEntries?: DefaultEntryType[] | null;
|
||||
tableEntriesCount?: number | null;
|
||||
@ -1520,6 +1546,11 @@ export type PagePropsType = {
|
||||
docsObject?: DocsServerProps | null;
|
||||
docsPages?: DocsLinkType[] | null;
|
||||
docsPageEditURL?: string | null;
|
||||
isFolderPrivate?: boolean;
|
||||
};
|
||||
export type LocalFolderType = {
|
||||
name: string;
|
||||
isPrivate: boolean;
|
||||
};
|
||||
export type ResponseQueryObject = {
|
||||
sql?: string;
|
||||
@ -1969,6 +2000,7 @@ export type AddMediaAPIBody = {
|
||||
export type ReplaceMediaAPIBody = {
|
||||
mediaId: number;
|
||||
media: MediaUploadDataType;
|
||||
is_media_folder_private: boolean;
|
||||
};
|
||||
export declare const TargetMediaParadigms: readonly ["info", "preview"];
|
||||
export type TargetMediaDataType = {
|
||||
@ -2504,3 +2536,14 @@ export type SQLInsertGenParams = {
|
||||
tableName: string;
|
||||
dbFullName?: string;
|
||||
};
|
||||
export type APIReqParams = {
|
||||
media_id?: number;
|
||||
is_folder_private?: boolean;
|
||||
is_file_private?: boolean;
|
||||
raw_media?: MediaUploadDataType[];
|
||||
media_type?: "video" | "image" | "file";
|
||||
is_media_folder_private?: boolean;
|
||||
folder?: string;
|
||||
is_media_private?: boolean;
|
||||
force_update_media?: boolean;
|
||||
};
|
||||
|
||||
@ -24,37 +24,6 @@ export default async function handleUniqueConstraintsCreateDbFromSchema({
|
||||
tableName,
|
||||
tableUniqueConstraints,
|
||||
}: Param) {
|
||||
/**
|
||||
* # 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
|
||||
*/
|
||||
|
||||
@ -59,7 +59,7 @@ export type DSQL_DATASQUIREL_API_KEYS = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
key?: string;
|
||||
scope?: "readOnly" | "fullAccess";
|
||||
scope?: "readOnly" | "fullAccess" | "media";
|
||||
all_dbs?: 0 | 1;
|
||||
media_only?: 0 | 1;
|
||||
csrf?: string;
|
||||
@ -416,3 +416,5 @@ export type DSQL_DATASQUIREL_USER_PRIVATE_MEDIA_KEYS = {
|
||||
date_updated_code?: number;
|
||||
date_updated_timestamp?: string;
|
||||
}
|
||||
|
||||
export type DSQL_DATASQUIREL_ALL_TYPEDEFS = DSQL_DATASQUIREL_USERS & DSQL_DATASQUIREL_API_KEYS & DSQL_DATASQUIREL_API_KEYS_SCOPED_RESOURCES & DSQL_DATASQUIREL_INVITATIONS & DSQL_DATASQUIREL_USER_DATABASES & DSQL_DATASQUIREL_USER_DATABASE_TABLES & DSQL_DATASQUIREL_USER_MEDIA & DSQL_DATASQUIREL_USER_PRIVATE_FOLDERS & DSQL_DATASQUIREL_DELEGATED_USERS & DSQL_DATASQUIREL_DELEGATED_RESOURCES & DSQL_DATASQUIREL_MARIADB_USER_PRIVILEGES & DSQL_DATASQUIREL_UNSUBSCRIBES & DSQL_DATASQUIREL_NOTIFICATIONS & DSQL_DATASQUIREL_DELETED_API_KEYS & DSQL_DATASQUIREL_SERVERS & DSQL_DATASQUIREL_PROCESS_QUEUE & DSQL_DATASQUIREL_BACKUPS & DSQL_DATASQUIREL_MARIADB_USERS & DSQL_DATASQUIREL_MARIADB_USER_DATABASES & DSQL_DATASQUIREL_MARIADB_USER_TABLES & DSQL_DATASQUIREL_USER_PRIVATE_MEDIA_KEYS
|
||||
@ -101,10 +101,35 @@ export interface DSQL_TableSchemaType {
|
||||
indexes?: DSQL_IndexSchemaType[];
|
||||
uniqueConstraints?: DSQL_UniqueConstraintSchemaType[];
|
||||
childrenTables?: DSQL_ChildrenTablesType[];
|
||||
/**
|
||||
* Whether this is a child table
|
||||
*/
|
||||
childTable?: boolean;
|
||||
updateData?: boolean;
|
||||
/**
|
||||
* ID of the parent table
|
||||
*/
|
||||
childTableId?: string | number;
|
||||
/**
|
||||
* ID of the parent table
|
||||
*/
|
||||
parentTableId?: string | number;
|
||||
/**
|
||||
* ID of the Database of parent table
|
||||
*/
|
||||
parentTableDbId?: string | number;
|
||||
/**
|
||||
* Name of the Database of parent table
|
||||
*/
|
||||
parentTableDbName?: string;
|
||||
/**
|
||||
* Name of the parent table
|
||||
*/
|
||||
parentTableName?: string;
|
||||
tableNameOld?: string;
|
||||
/**
|
||||
* ID of the Database of parent table
|
||||
*/
|
||||
childTableDbId?: string | number;
|
||||
collation?: (typeof MariaDBCollations)[number];
|
||||
isVector?: boolean;
|
||||
@ -991,6 +1016,7 @@ export type ApiKeyObject = {
|
||||
sign?: string;
|
||||
date_code?: number;
|
||||
error?: string;
|
||||
media_only?: boolean;
|
||||
};
|
||||
|
||||
export type AddApiKeyRequestBody = {
|
||||
@ -1732,7 +1758,7 @@ export type PagePropsType = {
|
||||
mediaCurrentFolder?: string | null;
|
||||
appData?: DsqlAppData | null;
|
||||
staticHost?: string | null;
|
||||
folders?: string[] | null;
|
||||
folders?: LocalFolderType[] | null;
|
||||
activeClonedTable?: boolean | null;
|
||||
tableEntries?: DefaultEntryType[] | null;
|
||||
tableEntriesCount?: number | null;
|
||||
@ -1766,6 +1792,12 @@ export type PagePropsType = {
|
||||
docsObject?: DocsServerProps | null;
|
||||
docsPages?: DocsLinkType[] | null;
|
||||
docsPageEditURL?: string | null;
|
||||
isFolderPrivate?: boolean;
|
||||
};
|
||||
|
||||
export type LocalFolderType = {
|
||||
name: string;
|
||||
isPrivate: boolean;
|
||||
};
|
||||
|
||||
export type ResponseQueryObject = {
|
||||
@ -2535,6 +2567,7 @@ export type AddMediaAPIBody = {
|
||||
export type ReplaceMediaAPIBody = {
|
||||
mediaId: number;
|
||||
media: MediaUploadDataType;
|
||||
is_media_folder_private: boolean;
|
||||
};
|
||||
|
||||
export const TargetMediaParadigms = ["info", "preview"] as const;
|
||||
@ -3200,3 +3233,15 @@ export type SQLInsertGenParams = {
|
||||
tableName: string;
|
||||
dbFullName?: string;
|
||||
};
|
||||
|
||||
export type APIReqParams = {
|
||||
media_id?: number;
|
||||
is_folder_private?: boolean;
|
||||
is_file_private?: boolean;
|
||||
raw_media?: MediaUploadDataType[];
|
||||
media_type?: "video" | "image" | "file";
|
||||
is_media_folder_private?: boolean;
|
||||
folder?: string;
|
||||
is_media_private?: boolean;
|
||||
force_update_media?: boolean;
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "5.7.51",
|
||||
"version": "5.7.52",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user