Version: 4.3

Class: MySqlSchemaHelper

Hierarchy

  • SchemaHelper

    MySqlSchemaHelper

Methods

databaseExists

databaseExists(connection: Connection, name: string): Promise<boolean>

Inherited from MySqlSchemaHelper.databaseExists

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:40

Parameters:

NameType
connectionConnection
namestring

Returns: Promise<boolean>


finalizeTable

finalizeTable(table: CreateTableBuilder, charset: string): void

Overrides PostgreSqlSchemaHelper.finalizeTable

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:42

Parameters:

NameType
tableCreateTableBuilder
charsetstring

Returns: void


getColumns

getColumns(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<any[]>

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:82

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<any[]>


getCreateDatabaseSQL

getCreateDatabaseSQL(name: string): string

Inherited from MySqlSchemaHelper.getCreateDatabaseSQL

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:34

Parameters:

NameType
namestring

Returns: string


getDatabaseExistsSQL

getDatabaseExistsSQL(name: string): string

Inherited from MySqlSchemaHelper.getDatabaseExistsSQL

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:36

Parameters:

NameType
namestring

Returns: string


getDatabaseNotExistsError

getDatabaseNotExistsError(dbName: string): string

Inherited from MySqlSchemaHelper.getDatabaseNotExistsError

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:37

Parameters:

NameType
dbNamestring

Returns: string


getDefaultEmptyString

getDefaultEmptyString(): string

Inherited from MySqlSchemaHelper.getDefaultEmptyString

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:39

Returns: string


getDropDatabaseSQL

getDropDatabaseSQL(name: string): string

Inherited from MySqlSchemaHelper.getDropDatabaseSQL

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:35

Parameters:

NameType
namestring

Returns: string


getEnumDefinitions

getEnumDefinitions(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<Dictionary>

Overrides SqliteSchemaHelper.getEnumDefinitions

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:71

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Dictionary>


getForeignKeys

getForeignKeys(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<Dictionary>

Inherited from MySqlSchemaHelper.getForeignKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:19

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Dictionary>


getForeignKeysSQL

getForeignKeysSQL(tableName: string, schemaName?: string): string

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:64

Parameters:

NameType
tableNamestring
schemaName?string

Returns: string


getIndexName

getIndexName(tableName: string, columns: string[], type: "index" | "unique" | "foreign"): string

Inherited from MySqlSchemaHelper.getIndexName

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:29

Returns the default name of index for the given columns

Parameters:

NameType
tableNamestring
columnsstring[]
type"index" | "unique" | "foreign"

Returns: string


getIndexes

getIndexes(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<Index[]>

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:98

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Index[]>


getListTablesSQL

getListTablesSQL(): string

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:55

Returns: string


getManagementDbName

getManagementDbName(): string

Inherited from MySqlSchemaHelper.getManagementDbName

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:38

Returns: string


getPrimaryKeys

getPrimaryKeys(connection: AbstractSqlConnection, indexes: Index[], tableName: string, schemaName?: string): Promise<string[]>

Inherited from MySqlSchemaHelper.getPrimaryKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:18

Parameters:

NameType
connectionAbstractSqlConnection
indexesIndex[]
tableNamestring
schemaName?string

Returns: Promise<string[]>


getRenameColumnSQL

getRenameColumnSQL(tableName: string, from: Column, to: EntityProperty, idx?: number): string

Overrides PostgreSqlSchemaHelper.getRenameColumnSQL

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:59

Parameters:

NameTypeDefault value
tableNamestring-
fromColumn-
toEntityProperty-
idxnumber0

Returns: string


getSchemaBeginning

getSchemaBeginning(charset: string): string

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:34

Parameters:

NameType
charsetstring

Returns: string


getSchemaEnd

getSchemaEnd(): string

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:38

Returns: string


getTypeDefinition

getTypeDefinition(prop: EntityProperty): string

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:47

Parameters:

NameType
propEntityProperty

Returns: string


getTypeFromDefinition

getTypeFromDefinition(type: string, defaultType: string): string

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:51

Parameters:

NameType
typestring
defaultTypestring

Returns: string


indexForeignKeys

indexForeignKeys(): boolean

Inherited from MySqlSchemaHelper.indexForeignKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:12

Returns: boolean


isImplicitIndex

isImplicitIndex(name: string): boolean

Inherited from MySqlSchemaHelper.isImplicitIndex

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:16

Implicit indexes will be ignored when diffing

Parameters:

NameType
namestring

Returns: boolean


isSame

isSame(prop: EntityProperty, column: Column, idx?: number): IsSame

Overrides void

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:110

Parameters:

NameType
propEntityProperty
columnColumn
idx?number

Returns: IsSame


mapForeignKeys

mapForeignKeys(fks: any[]): Dictionary

Inherited from MySqlSchemaHelper.mapForeignKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:30

Parameters:

NameType
fksany[]

Returns: Dictionary


normalizeDefaultValue

normalizeDefaultValue(defaultValue: string, length: number): string | number

Overrides SqliteSchemaHelper.normalizeDefaultValue

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:114

Parameters:

NameType
defaultValuestring
lengthnumber

Returns: string | number


supportsColumnAlter

supportsColumnAlter(): boolean

Inherited from MySqlSchemaHelper.supportsColumnAlter

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:32

Returns: boolean


supportsSchemaConstraints

supportsSchemaConstraints(): boolean

Inherited from MySqlSchemaHelper.supportsSchemaConstraints

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:11

Returns: boolean

Object literals

DEFAULT_TYPE_LENGTHS

Static Readonly DEFAULT_TYPE_LENGTHS: object

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:22

Properties:

NameTypeValue
datenumber0
numbernumber11
stringnumber255

DEFAULT_VALUES

Static Readonly DEFAULT_VALUES: object

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:28

Properties:

NameTypeValue
0string[]['0', 'false']
current_timestamp(?)string[]['current_timestamp(?)']
now()string[]['now()', 'current_timestamp']

TYPES

Static Readonly TYPES: object

Defined in packages/mysql-base/src/MySqlSchemaHelper.ts:6

Properties:

NameTypeValue
Datestring[]['datetime(?)', 'timestamp(?)', 'datetime', 'timestamp']
booleanstring[]['tinyint(1)', 'tinyint']
datestring[]['datetime(?)', 'timestamp(?)', 'datetime', 'timestamp']
doublestring[]['double']
enumstring[]['enum']
floatstring[]['float']
jsonstring[]['json']
numberstring[]['int(?)', 'int', 'float', 'double', 'tinyint', 'smallint']
objectstring[]['json']
smallintstring[]['smallint']
stringstring[]['varchar(?)', 'varchar', 'text', 'bigint', 'enum']
textstring[]['text']
tinyintstring[]['tinyint']
Last updated on by Martin Adámek