Updates
This commit is contained in:
@@ -23,6 +23,7 @@ import type DataTypes from "../data/data-types";
|
||||
import type { IncomingMessage, ServerResponse } from "http";
|
||||
import type { CookieNames } from "../dict/cookie-names";
|
||||
import { ConnectionConfig } from "mariadb";
|
||||
import { DbContextsArray } from "../functions/backend/db/runQuery";
|
||||
|
||||
export type DSQL_DatabaseFullName = string;
|
||||
|
||||
@@ -98,6 +99,7 @@ export interface DSQL_TableSchemaType {
|
||||
tableDescription?: string;
|
||||
fields: DSQL_FieldSchemaType[];
|
||||
indexes?: DSQL_IndexSchemaType[];
|
||||
uniqueConstraints?: DSQL_UniqueConstraintSchemaType[];
|
||||
childrenTables?: DSQL_ChildrenTablesType[];
|
||||
childTable?: boolean;
|
||||
updateData?: boolean;
|
||||
@@ -178,6 +180,17 @@ export interface DSQL_IndexSchemaType {
|
||||
newTempIndex?: boolean;
|
||||
}
|
||||
|
||||
export interface DSQL_UniqueConstraintSchemaType {
|
||||
id?: string | number;
|
||||
constraintName?: string;
|
||||
alias?: string;
|
||||
constraintTableFields?: DSQL_UniqueConstraintFieldType[];
|
||||
}
|
||||
|
||||
export interface DSQL_UniqueConstraintFieldType {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface DSQL_IndexTableFieldType {
|
||||
value: string;
|
||||
dataType: string;
|
||||
@@ -203,6 +216,22 @@ export interface DSQL_MYSQL_SHOW_COLUMNS_Type {
|
||||
Extra: string;
|
||||
}
|
||||
|
||||
export interface DSQL_MARIADB_SHOW_INDEXES_TYPE {
|
||||
Table: string;
|
||||
Non_unique: 0 | 1;
|
||||
Key_name: string;
|
||||
Seq_in_index: number;
|
||||
Column_name: string;
|
||||
Collation: string;
|
||||
Cardinality: number;
|
||||
Sub_part?: string;
|
||||
Packed?: string;
|
||||
Index_type?: "BTREE";
|
||||
Comment?: string;
|
||||
Index_comment?: string;
|
||||
Ignored?: "YES" | "NO";
|
||||
}
|
||||
|
||||
export interface DSQL_MYSQL_FOREIGN_KEYS_Type {
|
||||
CONSTRAINT_NAME: string;
|
||||
CONSTRAINT_SCHEMA: string;
|
||||
@@ -1541,6 +1570,7 @@ export type DsqlCrudParam<
|
||||
dbName?: string;
|
||||
tableSchema?: DSQL_TableSchemaType;
|
||||
dbConfig?: ConnectionConfig;
|
||||
onDuplicate?: AddDbEntryParamOnDuplicate;
|
||||
};
|
||||
|
||||
export type DsqlCrudParamWhereClause = {
|
||||
@@ -1939,10 +1969,13 @@ export const FileMimeTypes = [
|
||||
export const CurrentlyEditedFieldActions = [
|
||||
"edit-field",
|
||||
"edit-index",
|
||||
"edit-unique-constraint",
|
||||
"delete-field",
|
||||
"delete-index",
|
||||
"delete-unique-constraint",
|
||||
"new-field",
|
||||
"new-index",
|
||||
"new-unique-constraint",
|
||||
"move-up",
|
||||
"move-down",
|
||||
"complete",
|
||||
@@ -1952,6 +1985,8 @@ export type CurrentlyEditedTableSchemaType = {
|
||||
action: (typeof CurrentlyEditedFieldActions)[number];
|
||||
field?: DSQL_FieldSchemaType;
|
||||
fieldIndex?: number;
|
||||
uniqueConstraint?: DSQL_UniqueConstraintSchemaType;
|
||||
uniqueConstraintIndex?: number;
|
||||
index?: DSQL_IndexSchemaType;
|
||||
indexIndex?: number;
|
||||
spliceIndex?: number;
|
||||
@@ -3001,3 +3036,34 @@ export type DSQLFetchApiOptions<
|
||||
csrfKey?: string;
|
||||
fetchOptions?: RequestInit;
|
||||
};
|
||||
|
||||
export type AddDbEntryParam<
|
||||
T extends { [k: string]: any } = any,
|
||||
K extends string = string
|
||||
> = {
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
paradigm?: "Read Only" | "Full Access";
|
||||
dbFullName?: string;
|
||||
tableName: K;
|
||||
data?: T;
|
||||
batchData?: T[];
|
||||
tableSchema?: DSQL_TableSchemaType;
|
||||
duplicateColumnName?: keyof T;
|
||||
duplicateColumnValue?: string | number;
|
||||
/**
|
||||
* Update Entry if a duplicate is found.
|
||||
* Requires `duplicateColumnName` and `duplicateColumnValue` parameters
|
||||
*/
|
||||
update?: boolean;
|
||||
encryptionKey?: string;
|
||||
encryptionSalt?: string;
|
||||
forceLocal?: boolean;
|
||||
debug?: boolean;
|
||||
dbConfig?: ConnectionConfig;
|
||||
onDuplicate?: AddDbEntryParamOnDuplicate;
|
||||
};
|
||||
|
||||
export type AddDbEntryParamOnDuplicate = {
|
||||
sql: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user