Skip to main content
Version: 5.9

MariaDbSchemaHelper

Hierarchy

  • SchemaHelper
    • MariaDbSchemaHelper

Index

Constructors

constructor

  • new MariaDbSchemaHelper(platform: AbstractSqlPlatform): MariaDbSchemaHelper
  • Parameters

    • platform: AbstractSqlPlatform

    Returns MariaDbSchemaHelper

Properties

staticreadonlyDEFAULT_VALUES

DEFAULT_VALUES: { 0: string[]; current_timestamp(?): string[]; now(): string[] } = ...

Type declaration

  • 0: string[]
  • current_timestamp(?): string[]
  • now(): string[]

Methods

configureColumn

  • configureColumn(column: Column, col: ColumnBuilder, knex: Knex<any, any[]>, changedProperties?: Set<string>): ColumnBuilder
  • Parameters

    • column: Column
    • col: ColumnBuilder
    • knex: Knex<any, any[]>
    • optionalchangedProperties: Set<string>

    Returns ColumnBuilder

configureColumnDefault

  • configureColumnDefault(column: Column, col: ColumnBuilder, knex: Knex<any, any[]>, changedProperties?: Set<string>): ColumnBuilder
  • Parameters

    • column: Column
    • col: ColumnBuilder
    • knex: Knex<any, any[]>
    • optionalchangedProperties: Set<string>

    Returns ColumnBuilder

createTableColumn

  • createTableColumn(table: TableBuilder, column: Column, fromTable: DatabaseTable, changedProperties?: Set<string>): ColumnBuilder
  • Parameters

    • table: TableBuilder
    • column: Column
    • fromTable: DatabaseTable
    • optionalchangedProperties: Set<string>

    Returns ColumnBuilder

databaseExists

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

    • connection: Connection
    • name: string

    Returns Promise<boolean>

disableForeignKeysSQL

  • disableForeignKeysSQL(): string
  • Returns string

enableForeignKeysSQL

  • enableForeignKeysSQL(): string
  • Returns string

finalizeTable

  • finalizeTable(table: CreateTableBuilder, charset: string, collate?: string): void
  • Parameters

    • table: CreateTableBuilder
    • charset: string
    • optionalcollate: string

    Returns void

getAllChecks

  • getAllChecks(connection: AbstractSqlConnection, tables: Table[], columns?: Dictionary<Column[]>): Promise<Dictionary<Check<unknown>[]>>
  • Parameters

    • connection: AbstractSqlConnection
    • tables: Table[]
    • optionalcolumns: Dictionary<Column[]>

    Returns Promise<Dictionary<Check<unknown>[]>>

getAllColumns

  • getAllColumns(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Column[]>>
  • Parameters

    • connection: AbstractSqlConnection
    • tables: Table[]

    Returns Promise<Dictionary<Column[]>>

getAllEnumDefinitions

  • getAllEnumDefinitions(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Dictionary<string[]>>>
  • Parameters

    • connection: AbstractSqlConnection
    • tables: Table[]

    Returns Promise<Dictionary<Dictionary<string[]>>>

getAllForeignKeys

  • getAllForeignKeys(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Dictionary<ForeignKey>>>
  • Parameters

    • connection: AbstractSqlConnection
    • tables: Table[]

    Returns Promise<Dictionary<Dictionary<ForeignKey>>>

getAllIndexes

  • getAllIndexes(connection: AbstractSqlConnection, tables: Table[]): Promise<Dictionary<Index[]>>
  • Parameters

    • connection: AbstractSqlConnection
    • tables: Table[]

    Returns Promise<Dictionary<Index[]>>

getAlterColumnAutoincrement

  • getAlterColumnAutoincrement(tableName: string, column: Column, schemaName?: string): string
  • Parameters

    • tableName: string
    • column: Column
    • optionalschemaName: string

    Returns string

getChangeColumnCommentSQL

  • getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string
  • Parameters

    • tableName: string
    • to: Column
    • optionalschemaName: string

    Returns string

getChecks

  • getChecks(connection: AbstractSqlConnection, tableName: string, schemaName: string, columns?: Column[]): Promise<Check<unknown>[]>
  • Parameters

    • connection: AbstractSqlConnection
    • tableName: string
    • schemaName: string
    • optionalcolumns: Column[]

    Returns Promise<Check<unknown>[]>

getColumns

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

    • connection: AbstractSqlConnection
    • tableName: string
    • optionalschemaName: string

    Returns Promise<Column[]>

getCreateDatabaseSQL

  • getCreateDatabaseSQL(name: string): string
  • Parameters

    • name: string

    Returns string

getCreateIndexSQL

  • getCreateIndexSQL(tableName: string, index: Index): string
  • Parameters

    • tableName: string
    • index: Index

    Returns string

getDatabaseExistsSQL

  • getDatabaseExistsSQL(name: string): string
  • Parameters

    • name: string

    Returns string

getDatabaseNotExistsError

  • getDatabaseNotExistsError(dbName: string): string
  • Parameters

    • dbName: string

    Returns string

getDefaultEmptyString

  • getDefaultEmptyString(): string
  • Returns string

getDropDatabaseSQL

  • getDropDatabaseSQL(name: string): string
  • Parameters

    • name: string

    Returns string

getDropIndexSQL

  • getDropIndexSQL(tableName: string, index: Index): string
  • Parameters

    • tableName: string
    • index: Index

    Returns string

getEnumDefinitions

  • getEnumDefinitions(connection: AbstractSqlConnection, checks: Check<unknown>[], tableName: string, schemaName?: string): Promise<Dictionary<string[]>>
  • Parameters

    • connection: AbstractSqlConnection
    • checks: Check<unknown>[]
    • tableName: string
    • optionalschemaName: string

    Returns Promise<Dictionary<string[]>>

getForeignKeys

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

    • connection: AbstractSqlConnection
    • tableName: string
    • optionalschemaName: string

    Returns Promise<Dictionary>

getForeignKeysSQL

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

    • tableName: string
    • optionalschemaName: string

    Returns string

getIndexes

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

    • connection: AbstractSqlConnection
    • tableName: string
    • optionalschemaName: string

    Returns Promise<Index[]>

getListTablesSQL

  • getListTablesSQL(): string
  • Returns string

getManagementDbName

  • getManagementDbName(): string
  • Returns string

getNamespaces

  • getNamespaces(connection: AbstractSqlConnection): Promise<string[]>
  • Parameters

    • connection: AbstractSqlConnection

    Returns Promise<string[]>

getPreAlterTable

  • getPreAlterTable(tableDiff: TableDifference, safe: boolean): string
  • Parameters

    • tableDiff: TableDifference
    • safe: boolean

    Returns string

getPrimaryKeys

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

    • connection: AbstractSqlConnection
    • indexes: Index[] = []
    • tableName: string
    • optionalschemaName: string

    Returns Promise<string[]>

getRenameColumnSQL

  • getRenameColumnSQL(tableName: string, oldColumnName: string, to: Column): string
  • Parameters

    • tableName: string
    • oldColumnName: string
    • to: Column

    Returns string

getRenameIndexSQL

  • getRenameIndexSQL(tableName: string, index: Index, oldIndexName: string): string
  • Parameters

    • tableName: string
    • index: Index
    • oldIndexName: string

    Returns string

getSchemaBeginning

  • getSchemaBeginning(charset: string): string
  • Parameters

    • charset: string

    Returns string

getSchemaEnd

  • getSchemaEnd(): string
  • Returns string

hasNonDefaultPrimaryKeyName

  • hasNonDefaultPrimaryKeyName(table: DatabaseTable): boolean
  • Parameters

    • table: DatabaseTable

    Returns boolean

loadInformationSchema

  • loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[]): Promise<void>
  • Parameters

    • schema: DatabaseSchema
    • connection: AbstractSqlConnection
    • tables: Table[]

    Returns Promise<void>

mapForeignKeys

  • mapForeignKeys(fks: any[], tableName: string, schemaName?: string): Dictionary
  • Parameters

    • fks: any[]
    • tableName: string
    • optionalschemaName: string

    Returns Dictionary

normalizeDefaultValue

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

    • defaultValue: string
    • length: number

    Returns string | number

pushTableQuery

  • pushTableQuery(table: TableBuilder, expression: string, grouping?: string): void
  • Uses raw method injected in AbstractSqlConnection to allow adding custom queries inside alter statements.


    Parameters

    • table: TableBuilder
    • expression: string
    • grouping: string = 'alterTable'

    Returns void

supportsSchemaConstraints

  • supportsSchemaConstraints(): boolean
  • Returns boolean