MySqlSchemaHelper
Hierarchy
- SchemaHelper
- MySqlSchemaHelper
Index
Constructors
Properties
Methods
- configureColumn
- configureColumnDefault
- createTableColumn
- databaseExists
- disableForeignKeysSQL
- enableForeignKeysSQL
- finalizeTable
- getAllChecks
- getAllColumns
- getAllEnumDefinitions
- getAllForeignKeys
- getAllIndexes
- getAlterColumnAutoincrement
- getChangeColumnCommentSQL
- getChecks
- getColumns
- getCreateDatabaseSQL
- getCreateIndexSQL
- getDatabaseExistsSQL
- getDatabaseNotExistsError
- getDefaultEmptyString
- getDropDatabaseSQL
- getDropIndexSQL
- getEnumDefinitions
- getForeignKeys
- getForeignKeysSQL
- getIndexes
- getListTablesSQL
- getManagementDbName
- getNamespaces
- getPreAlterTable
- getPrimaryKeys
- getRenameColumnSQL
- getRenameIndexSQL
- getSchemaBeginning
- getSchemaEnd
- hasNonDefaultPrimaryKeyName
- loadInformationSchema
- mapForeignKeys
- normalizeDefaultValue
- pushTableQuery
- supportsSchemaConstraints
Constructors
constructor
Parameters
platform: AbstractSqlPlatform
Returns MySqlSchemaHelper
Properties
staticreadonlyDEFAULT_VALUES
Type declaration
0: string[]
current_timestamp(?): string[]
now(): string[]
Methods
configureColumn
Parameters
column: Column
col: ColumnBuilder
knex: Knex<any, any[]>
optionalchangedProperties: Set<string>
Returns ColumnBuilder
configureColumnDefault
Parameters
column: Column
col: ColumnBuilder
knex: Knex<any, any[]>
optionalchangedProperties: Set<string>
Returns ColumnBuilder
createTableColumn
Parameters
table: TableBuilder
column: Column
fromTable: DatabaseTable
optionalchangedProperties: Set<string>
Returns ColumnBuilder
databaseExists
Parameters
connection: Connection
name: string
Returns Promise<boolean>
disableForeignKeysSQL
Returns string
enableForeignKeysSQL
Returns string
finalizeTable
Parameters
table: CreateTableBuilder
charset: string
optionalcollate: string
Returns void
getAllChecks
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<Check<unknown>[]>>
getAllColumns
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<Column[]>>
getAllEnumDefinitions
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<Dictionary<string[]>>>
getAllForeignKeys
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<Dictionary<ForeignKey>>>
getAllIndexes
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<Index[]>>
getAlterColumnAutoincrement
Parameters
tableName: string
column: Column
optionalschemaName: string
Returns string
getChangeColumnCommentSQL
Parameters
tableName: string
to: Column
optionalschemaName: string
Returns string
getChecks
Parameters
connection: AbstractSqlConnection
tableName: string
schemaName: string
optionalcolumns: Column[]
Returns Promise<Check<unknown>[]>
getColumns
Parameters
connection: AbstractSqlConnection
tableName: string
optionalschemaName: string
Returns Promise<Column[]>
getCreateDatabaseSQL
Parameters
name: string
Returns string
getCreateIndexSQL
Parameters
tableName: string
index: Index
Returns string
getDatabaseExistsSQL
Parameters
name: string
Returns string
getDatabaseNotExistsError
Parameters
dbName: string
Returns string
getDefaultEmptyString
Returns string
getDropDatabaseSQL
Parameters
name: string
Returns string
getDropIndexSQL
Parameters
tableName: string
index: Index
Returns string
getEnumDefinitions
Parameters
connection: AbstractSqlConnection
checks: Check<unknown>[]
tableName: string
optionalschemaName: string
Returns Promise<Dictionary<string[]>>
getForeignKeys
Parameters
connection: AbstractSqlConnection
tableName: string
optionalschemaName: string
Returns Promise<Dictionary>
getForeignKeysSQL
Parameters
tableName: string
optionalschemaName: string
Returns string
getIndexes
Parameters
connection: AbstractSqlConnection
tableName: string
optionalschemaName: string
Returns Promise<Index[]>
getListTablesSQL
Returns string
getManagementDbName
Returns string
getNamespaces
Parameters
connection: AbstractSqlConnection
Returns Promise<string[]>
getPreAlterTable
Parameters
tableDiff: TableDifference
safe: boolean
Returns string
getPrimaryKeys
Parameters
connection: AbstractSqlConnection
indexes: Index[] = []
tableName: string
optionalschemaName: string
Returns Promise<string[]>
getRenameColumnSQL
Parameters
tableName: string
oldColumnName: string
to: Column
Returns string
getRenameIndexSQL
Parameters
tableName: string
index: Index
oldIndexName: string
Returns string
getSchemaBeginning
Parameters
charset: string
Returns string
getSchemaEnd
Returns string
hasNonDefaultPrimaryKeyName
Parameters
table: DatabaseTable
Returns boolean
loadInformationSchema
Parameters
schema: DatabaseSchema
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<void>
mapForeignKeys
Parameters
fks: any[]
tableName: string
optionalschemaName: string
Returns Dictionary
normalizeDefaultValue
Parameters
defaultValue: string
length: number
Returns string | number
pushTableQuery
Parameters
table: TableBuilder
expression: string
grouping: string = 'alterTable'
Returns void
supportsSchemaConstraints
Returns boolean
Uses
raw
method injected inAbstractSqlConnection
to allow adding custom queries inside alter statements.