48 lines
2.9 KiB
TypeScript
48 lines
2.9 KiB
TypeScript
import { type Dictionary, type Type } from '@mikro-orm/core';
|
|
import type { CheckDef, Column, ForeignKey, IndexDef, Table, TableDifference } from '../../typings.js';
|
|
import type { AbstractSqlConnection } from '../../AbstractSqlConnection.js';
|
|
import { SchemaHelper } from '../../schema/SchemaHelper.js';
|
|
import type { DatabaseSchema } from '../../schema/DatabaseSchema.js';
|
|
import type { DatabaseTable } from '../../schema/DatabaseTable.js';
|
|
export declare class MySqlSchemaHelper extends SchemaHelper {
|
|
#private;
|
|
static readonly DEFAULT_VALUES: {
|
|
'now()': string[];
|
|
'current_timestamp(?)': string[];
|
|
'0': string[];
|
|
};
|
|
getSchemaBeginning(charset: string, disableForeignKeys?: boolean): string;
|
|
disableForeignKeysSQL(): string;
|
|
enableForeignKeysSQL(): string;
|
|
finalizeTable(table: DatabaseTable, charset: string, collate?: string): string;
|
|
getListTablesSQL(): string;
|
|
getListViewsSQL(): string;
|
|
loadViews(schema: DatabaseSchema, connection: AbstractSqlConnection, schemaName?: string): Promise<void>;
|
|
loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[]): Promise<void>;
|
|
getAllIndexes(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<IndexDef[]>>;
|
|
getCreateIndexSQL(tableName: string, index: IndexDef, partialExpression?: boolean): string;
|
|
/**
|
|
* Build the column list for a MySQL index, with MySQL-specific handling for collation.
|
|
* MySQL requires collation to be specified as an expression: (column_name COLLATE collation_name)
|
|
*/
|
|
protected getIndexColumns(index: IndexDef): string;
|
|
/**
|
|
* Append MySQL-specific index suffixes like INVISIBLE.
|
|
*/
|
|
protected appendMySqlIndexSuffix(sql: string, index: IndexDef): string;
|
|
getAllColumns(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Column[]>>;
|
|
getAllChecks(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<CheckDef[]>>;
|
|
getAllForeignKeys(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Dictionary<ForeignKey>>>;
|
|
getPreAlterTable(tableDiff: TableDifference, safe: boolean): string[];
|
|
getRenameColumnSQL(tableName: string, oldColumnName: string, to: Column): string;
|
|
getRenameIndexSQL(tableName: string, index: IndexDef, oldIndexName: string): string[];
|
|
getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string;
|
|
alterTableColumn(column: Column, table: DatabaseTable, changedProperties: Set<string>): string[];
|
|
private getColumnDeclarationSQL;
|
|
getAllEnumDefinitions(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Dictionary<string[]>>>;
|
|
private supportsCheckConstraints;
|
|
protected getChecksSQL(tables: Table[]): string;
|
|
normalizeDefaultValue(defaultValue: string, length: number): string | number;
|
|
protected wrap(val: string | null | undefined, type: Type<unknown>): string | null | undefined;
|
|
}
|