Skip to main content
Version: 5.9

MySqlPlatform

Hierarchy

  • AbstractSqlPlatform
    • MySqlPlatform

Index

Constructors

Methods

Constructors

constructor

  • new MySqlPlatform(): MySqlPlatform
  • Returns MySqlPlatform

Methods

allowsComparingTuples

  • allowsComparingTuples(): boolean
  • Returns boolean

allowsMultiInsert

  • allowsMultiInsert(): boolean
  • Returns boolean

allowsUniqueBatchUpdates

  • allowsUniqueBatchUpdates(): boolean
  • Returns boolean

cloneEmbeddable

  • cloneEmbeddable<T>(data: T): T
  • Type parameters

    • T

    Parameters

    • data: T

    Returns T

convertJsonToDatabaseValue

  • convertJsonToDatabaseValue(value: unknown, context?: TransformContext): unknown
  • Parameters

    • value: unknown
    • optionalcontext: TransformContext

    Returns unknown

convertJsonToJSValue

  • convertJsonToJSValue(value: unknown): unknown
  • Parameters

    • value: unknown

    Returns unknown

convertsJsonAutomatically

  • convertsJsonAutomatically(marshall?: boolean): boolean
  • Parameters

    • marshall: boolean = false

    Returns boolean

denormalizePrimaryKey

  • denormalizePrimaryKey(data: IPrimaryKeyValue): IPrimaryKeyValue
  • Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)


    Parameters

    • data: IPrimaryKeyValue

    Returns IPrimaryKeyValue

extractSimpleType

  • extractSimpleType(type: string): string
  • Parameters

    • type: string

    Returns string

formatQuery

  • formatQuery(sql: string, params: readonly any[]): string
  • Parameters

    • sql: string
    • params: readonly any[]

    Returns string

generateCustomOrder

  • generateCustomOrder(escapedColumn: string, values: unknown[]): string
  • Generates a custom order by statement given a set of in order values, eg. ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)


    Parameters

    • escapedColumn: string
    • values: unknown[]

    Returns string

getArrayDeclarationSQL

  • getArrayDeclarationSQL(): string
  • Returns string

getBigIntTypeDeclarationSQL

  • getBigIntTypeDeclarationSQL(column: { autoincrement?: boolean; length?: number; unsigned?: boolean }): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getBlobDeclarationSQL

  • getBlobDeclarationSQL(): string
  • Returns string

getBooleanTypeDeclarationSQL

  • getBooleanTypeDeclarationSQL(): string
  • Returns string

getConfig

  • getConfig(): Configuration<IDatabaseDriver<Connection>>
  • Returns Configuration<IDatabaseDriver<Connection>>

getCurrentTimestampSQL

  • getCurrentTimestampSQL(length?: number): string
  • Returns the SQL specific for the platform to get the current timestamp


    Parameters

    • optionallength: number

    Returns string

getDateTimeTypeDeclarationSQL

  • getDateTimeTypeDeclarationSQL(column: { length?: number }): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

getDateTypeDeclarationSQL

  • getDateTypeDeclarationSQL(length?: number): string
  • Parameters

    • optionallength: number

    Returns string

getDecimalTypeDeclarationSQL

  • getDecimalTypeDeclarationSQL(column: { precision?: number; scale?: number }): string
  • Parameters

    • column: { precision?: number; scale?: number }
      • optionalprecision: number
      • optionalscale: number

    Returns string

getDefaultCharset

  • getDefaultCharset(): string
  • Returns string

getDefaultDateTimeLength

  • getDefaultDateTimeLength(): number
  • Returns number

getDefaultMappedType

  • getDefaultMappedType(type: string): Type<unknown, unknown>
  • Parameters

    • type: string

    Returns Type<unknown, unknown>

getDefaultPrimaryName

  • getDefaultPrimaryName(tableName: string, columns: string[]): string
  • Parameters

    • tableName: string
    • columns: string[]

    Returns string

getDefaultSchemaName

  • getDefaultSchemaName(): undefined | string
  • Returns undefined | string

getDefaultVersionLength

  • getDefaultVersionLength(): number
  • Returns number

getDoubleDeclarationSQL

  • getDoubleDeclarationSQL(): string
  • Returns string

getEntityGenerator

  • getEntityGenerator(em: EntityManager<IDatabaseDriver<Connection>>): any
  • Parameters

    • em: EntityManager<IDatabaseDriver<Connection>>

    Returns any

getEnumTypeDeclarationSQL

  • getEnumTypeDeclarationSQL(column: { autoincrement?: boolean; fieldNames: string[]; items?: unknown[]; length?: number; unsigned?: boolean }): string
  • Parameters

    • column: { autoincrement?: boolean; fieldNames: string[]; items?: unknown[]; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • fieldNames: string[]
      • optionalitems: unknown[]
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getExceptionConverter

  • getExceptionConverter(): ExceptionConverter
  • Returns ExceptionConverter

getFloatDeclarationSQL

  • getFloatDeclarationSQL(): string
  • Returns string

getFullTextIndexExpression

  • getFullTextIndexExpression(indexName: string, schemaName: undefined | string, tableName: string, columns: SimpleColumnMeta[]): string
  • Parameters

    • indexName: string
    • schemaName: undefined | string
    • tableName: string
    • columns: SimpleColumnMeta[]

    Returns string

getFullTextWhereClause

  • getFullTextWhereClause(): string
  • Returns string

getIndexName

  • getIndexName(tableName: string, columns: string[], type: index | unique | foreign | primary | sequence): string
  • Returns the default name of index for the given columns cannot go past 64 character length for identifiers in MySQL


    Parameters

    • tableName: string
    • columns: string[]
    • type: index | unique | foreign | primary | sequence

    Returns string

getIntegerTypeDeclarationSQL

  • getIntegerTypeDeclarationSQL(column: { autoincrement?: boolean; length?: number; unsigned?: boolean }): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getJsonDeclarationSQL

  • getJsonDeclarationSQL(): string
  • Returns string

getMappedType

  • getMappedType(type: string): Type<unknown, unknown>
  • Parameters

    • type: string

    Returns Type<unknown, unknown>

getMediumIntTypeDeclarationSQL

  • getMediumIntTypeDeclarationSQL(column: { autoincrement?: boolean; length?: number; unsigned?: boolean }): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getMigrator

  • getMigrator(em: EntityManager<IDatabaseDriver<Connection>>): any
  • Parameters

    • em: EntityManager<IDatabaseDriver<Connection>>

    Returns any

getNamingStrategy

  • getNamingStrategy(): new () => NamingStrategy
  • Returns new () => NamingStrategy

      • new (): NamingStrategy
      • Returns NamingStrategy

getRegExpOperator

  • getRegExpOperator(val?: unknown, flags?: string): string
  • Parameters

    • optionalval: unknown
    • optionalflags: string

    Returns string

getRegExpValue

  • getRegExpValue(val: RegExp): { $flags?: string; $re: string }
  • Parameters

    • val: RegExp

    Returns { $flags?: string; $re: string }

    • optional$flags?: string
    • $re: string

getRepositoryClass

  • getRepositoryClass<T>(): Constructor<EntityRepository<T>>
  • Type parameters

    • T: object

    Returns Constructor<EntityRepository<T>>

getSchemaGenerator

  • getSchemaGenerator(driver: IDatabaseDriver<Connection>, em?: EntityManager<IDatabaseDriver<Connection>>): SchemaGenerator
  • Parameters

    • driver: IDatabaseDriver<Connection>
    • optionalem: EntityManager<IDatabaseDriver<Connection>>

    Returns SchemaGenerator

getSchemaHelper

  • getSchemaHelper(): undefined | SchemaHelper
  • Returns undefined | SchemaHelper

getSearchJsonPropertyKey

  • getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean): string
  • Parameters

    • path: string[]
    • type: string
    • aliased: boolean

    Returns string

getSearchJsonPropertySQL

  • getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string
  • Parameters

    • path: string
    • type: string
    • aliased: boolean

    Returns string

getSerializedPrimaryKeyField

  • getSerializedPrimaryKeyField(field: string): string
  • Used when serializing via toObject and toJSON methods, allows to use different PK field name (like id instead of _id)


    Parameters

    • field: string

    Returns string

getSmallIntTypeDeclarationSQL

  • getSmallIntTypeDeclarationSQL(column: { autoincrement?: boolean; length?: number; unsigned?: boolean }): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getTextTypeDeclarationSQL

  • getTextTypeDeclarationSQL(_column: { length?: number }): string
  • Parameters

    • _column: { length?: number }
      • optionallength: number

    Returns string

getTimeTypeDeclarationSQL

  • getTimeTypeDeclarationSQL(length?: number): string
  • Parameters

    • optionallength: number

    Returns string

getTinyIntTypeDeclarationSQL

  • getTinyIntTypeDeclarationSQL(column: { autoincrement?: boolean; length?: number; unsigned?: boolean }): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getUuidTypeDeclarationSQL

  • getUuidTypeDeclarationSQL(column: { length?: number }): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

getVarcharTypeDeclarationSQL

  • getVarcharTypeDeclarationSQL(column: { length?: number }): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

indexForeignKeys

  • indexForeignKeys(): boolean
  • Returns boolean

isAllowedTopLevelOperator

  • isAllowedTopLevelOperator(operator: string): boolean
  • Parameters

    • operator: string

    Returns boolean

isBigIntProperty

  • isBigIntProperty(prop: EntityProperty<any>): boolean
  • Parameters

    • prop: EntityProperty<any>

    Returns boolean

isNumericColumn

  • isNumericColumn(mappedType: Type<unknown, unknown>): boolean
  • Parameters

    • mappedType: Type<unknown, unknown>

    Returns boolean

isRaw

  • isRaw(value: any): boolean
  • Parameters

    • value: any

    Returns boolean

lookupExtensions

  • lookupExtensions(orm: MikroORM<IDatabaseDriver<Connection>>): void
  • Allows to register extensions of the driver automatically (e.g. SchemaGenerator extension in SQL drivers).


    Parameters

    • orm: MikroORM<IDatabaseDriver<Connection>>

    Returns void

marshallArray

  • marshallArray(values: string[]): string
  • Parameters

    • values: string[]

    Returns string

normalizePrimaryKey

  • normalizePrimaryKey<T>(data: IPrimaryKeyValue | Primary<T>): T
  • Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)


    Type parameters

    • T: string | number = string | number

    Parameters

    • data: IPrimaryKeyValue | Primary<T>

    Returns T

processDateProperty

  • processDateProperty(value: unknown): string | number | Date
  • Parameters

    • value: unknown

    Returns string | number | Date

quoteIdentifier

  • quoteIdentifier(id: string, quote?: string): string
  • Parameters

    • id: string
    • quote: string = '`'

    Returns string

quoteValue

  • quoteValue(value: any): string
  • Parameters

    • value: any

    Returns string

quoteVersionValue

  • quoteVersionValue(value: number | Date, prop: EntityProperty<any>): string | number | Date
  • Parameters

    • value: number | Date
    • prop: EntityProperty<any>

    Returns string | number | Date

setConfig

  • setConfig(config: Configuration<IDatabaseDriver<Connection>>): void
  • Parameters

    • config: Configuration<IDatabaseDriver<Connection>>

    Returns void

shouldHaveColumn

  • shouldHaveColumn<T>(prop: EntityProperty<T>, populate: boolean | PopulateOptions<T>[], includeFormulas?: boolean): boolean
  • Type parameters

    • T

    Parameters

    • prop: EntityProperty<T>
    • populate: boolean | PopulateOptions<T>[]
    • includeFormulas: boolean = true

    Returns boolean

supportsCreatingFullTextIndex

  • supportsCreatingFullTextIndex(): boolean
  • Returns boolean

supportsCustomPrimaryKeyNames

  • supportsCustomPrimaryKeyNames(): boolean
  • Returns boolean

supportsDownMigrations

  • supportsDownMigrations(): boolean
  • Currently not supported due to how knex does complex sqlite diffing (always based on current schema)


    Returns boolean

supportsMultipleStatements

  • supportsMultipleStatements(): boolean
  • Returns boolean

supportsSchemas

  • supportsSchemas(): boolean
  • Returns boolean

supportsTransactions

  • supportsTransactions(): boolean
  • Returns boolean

supportsUnsigned

  • supportsUnsigned(): boolean
  • Returns boolean

unmarshallArray

  • unmarshallArray(value: string): string[]
  • Parameters

    • value: string

    Returns string[]

usesBatchInserts

  • usesBatchInserts(): boolean
  • Whether or not the driver supports retuning list of created PKs back when multi-inserting


    Returns boolean

usesBatchUpdates

  • usesBatchUpdates(): boolean
  • Whether or not the driver supports updating many records at once


    Returns boolean

usesCascadeStatement

  • usesCascadeStatement(): boolean
  • Returns boolean

usesDefaultKeyword

  • usesDefaultKeyword(): boolean
  • Returns boolean

usesDifferentSerializedPrimaryKey

  • usesDifferentSerializedPrimaryKey(): boolean
  • Returns boolean

usesImplicitTransactions

  • usesImplicitTransactions(): boolean
  • Returns boolean

usesPivotTable

  • usesPivotTable(): boolean
  • Returns boolean

usesReturningStatement

  • usesReturningStatement(): boolean
  • Returns boolean

validateMetadata

  • validateMetadata(meta: EntityMetadata<any>): void
  • Parameters

    • meta: EntityMetadata<any>

    Returns void

Page Options