Skip to main content
Version: 5.9

abstractSchemaHelper

Hierarchy

  • SchemaHelper
    • SqliteSchemaHelper
    • BetterSqliteSchemaHelper
    • MariaDbSchemaHelper
    • MySqlSchemaHelper
    • PostgreSqlSchemaHelper

Index

Constructors

constructor

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

    • platform: AbstractSqlPlatform

    Returns SchemaHelper

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: TableBuilder, charset: string, collate?: string): void
  • Parameters

    • table: TableBuilder
    • charset: string
    • optionalcollate: string

    Returns void

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
    • optionalschemaName: 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(schemaName?: string): string
  • Parameters

    • optionalschemaName: 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, schemaName?: string): string
  • Parameters

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

    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, defaultValues?: Dictionary<string[]>): string | number
  • Parameters

    • defaultValue: string
    • optionallength: number
    • defaultValues: Dictionary<string[]> = {}

    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