MySqlSchemaHelper
Hierarchy
- SchemaHelper
- MySqlSchemaHelper
Index
Constructors
Properties
Accessors
Methods
- configureColumn
- configureColumnDefault
- createCheck
- createForeignKey
- createIndex
- createSchemaBuilder
- createTable
- createTableColumn
- databaseExists
- disableForeignKeysSQL
- dump
- enableForeignKeysSQL
- finalizeTable
- getAllChecks
- getAllColumns
- getAllEnumDefinitions
- getAllForeignKeys
- getAllIndexes
- getAlterColumnAutoincrement
- getAlterNativeEnumSQL
- getAlterTable
- getChangeColumnCommentSQL
- getChecks
- getColumns
- getCreateDatabaseSQL
- getCreateIndexSQL
- getCreateNamespaceSQL
- getCreateNativeEnumSQL
- getDatabaseExistsSQL
- getDatabaseNotExistsError
- getDefaultEmptyString
- getDropColumnsSQL
- getDropDatabaseSQL
- getDropIndexSQL
- getDropNamespaceSQL
- getDropNativeEnumSQL
- getEnumDefinitions
- getForeignKeys
- getForeignKeysSQL
- getIndexes
- getListTablesSQL
- getManagementDbName
- getNamespaces
- getPostAlterTable
- getPreAlterTable
- getPrimaryKeys
- getReferencedTableName
- getRenameColumnSQL
- getRenameIndexSQL
- getSchemaBeginning
- getSchemaEnd
- getTablesGroupedBySchemas
- hasNonDefaultPrimaryKeyName
- inferLengthFromColumnType
- loadInformationSchema
- mapForeignKeys
- normalizeDefaultValue
- pushTableQuery
- splitTableName
- supportsSchemaConstraints
Constructors
constructor
Parameters
platform: AbstractSqlPlatform
Returns MySqlSchemaHelper
Properties
staticreadonlyDEFAULT_VALUES
Type declaration
0: string[]
current_timestamp(?): string[]
now(): string[]
Accessors
knex
Returns Knex<any, any[]>
options
Returns { createForeignKeyConstraints?: boolean; disableForeignKeys?: boolean; ignoreSchema?: string[]; managementDbName?: string }
optionalcreateForeignKeyConstraints?: boolean
optionaldisableForeignKeys?: boolean
optionalignoreSchema?: string[]
optionalmanagementDbName?: string
Methods
configureColumn
configureColumnDefault
createCheck
Parameters
table: CreateTableBuilder
check: CheckDef<unknown>
Returns void
createForeignKey
Parameters
table: CreateTableBuilder
foreignKey: ForeignKey
optionalschema: string
Returns void
createIndex
Parameters
table: CreateTableBuilder
index: IndexDef
tableDef: DatabaseTable
createPrimary: boolean = false
Returns void
createSchemaBuilder
Parameters
optionalschema: string
Returns SchemaBuilder
createTable
Parameters
tableDef: DatabaseTable
optionalalter: boolean
Returns SchemaBuilder
createTableColumn
Parameters
table: MySqlTableBuilder
column: Column
fromTable: DatabaseTable
optionalchangedProperties: Set<string>
optionalalter: boolean
Returns undefined | ColumnBuilder
databaseExists
Parameters
connection: Connection
name: string
Returns Promise<boolean>
disableForeignKeysSQL
Returns string
dump
Parameters
builder: string | SchemaBuilder
append: string
Returns Promise<string>
enableForeignKeysSQL
Returns string
finalizeTable
Parameters
table: CreateTableBuilder
charset: string
optionalcollate: string
Returns void
getAllChecks
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<CheckDef<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<IndexDef[]>>
getAlterColumnAutoincrement
Parameters
tableName: string
column: Column
optionalschemaName: string
Returns string
getAlterNativeEnumSQL
Parameters
name: string
optionalschema: string
optionalvalue: string
optionalitems: string[]
optionaloldItems: string[]
Returns string
optionalgetAlterTable
Parameters
changedTable: TableDifference
optionalwrap: boolean
Returns Promise<string>
getChangeColumnCommentSQL
Parameters
tableName: string
to: Column
optionalschemaName: string
Returns string
getChecks
Parameters
connection: AbstractSqlConnection
tableName: string
schemaName: string
optionalcolumns: Column[]
Returns Promise<CheckDef<unknown>[]>
getColumns
Parameters
connection: AbstractSqlConnection
tableName: string
optionalschemaName: string
Returns Promise<Column[]>
getCreateDatabaseSQL
Parameters
name: string
Returns string
getCreateIndexSQL
Parameters
tableName: string
index: IndexDef
partialExpression: boolean = false
Returns string
getCreateNamespaceSQL
Parameters
name: string
Returns string
getCreateNativeEnumSQL
Parameters
name: string
values: unknown[]
optionalschema: string
Returns string
getDatabaseExistsSQL
Parameters
name: string
Returns string
getDatabaseNotExistsError
Parameters
dbName: string
Returns string
getDefaultEmptyString
Returns string
getDropColumnsSQL
Parameters
tableName: string
columns: Column[]
optionalschemaName: string
Returns string
getDropDatabaseSQL
Parameters
name: string
Returns string
getDropIndexSQL
Parameters
tableName: string
index: IndexDef
Returns string
getDropNamespaceSQL
Parameters
name: string
Returns string
getDropNativeEnumSQL
Parameters
name: string
optionalschema: string
Returns string
getEnumDefinitions
Parameters
connection: AbstractSqlConnection
checks: CheckDef<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<IndexDef[]>
getListTablesSQL
Returns string
getManagementDbName
Returns string
getNamespaces
Parameters
connection: AbstractSqlConnection
Returns Promise<string[]>
getPostAlterTable
Parameters
tableDiff: TableDifference
safe: boolean
Returns string
getPreAlterTable
Parameters
tableDiff: TableDifference
safe: boolean
Returns string
getPrimaryKeys
Parameters
connection: AbstractSqlConnection
indexes: IndexDef[] = []
tableName: string
optionalschemaName: string
Returns Promise<string[]>
getReferencedTableName
Parameters
referencedTableName: string
optionalschema: string
Returns string
getRenameColumnSQL
Parameters
tableName: string
oldColumnName: string
to: Column
Returns string
getRenameIndexSQL
Parameters
tableName: string
index: IndexDef
oldIndexName: string
Returns string
getSchemaBeginning
Parameters
charset: string
optionaldisableForeignKeys: boolean
Returns string
getSchemaEnd
Parameters
optionaldisableForeignKeys: boolean
Returns string
getTablesGroupedBySchemas
hasNonDefaultPrimaryKeyName
Parameters
table: DatabaseTable
Returns boolean
inferLengthFromColumnType
Parameters
type: string
Returns undefined | number
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
splitTableName
Parameters
name: string
Returns [undefined | string, string]
supportsSchemaConstraints
Returns boolean
Uses
raw
method injected inAbstractSqlConnection
to allow adding custom queries inside alter statements.