Version: 4.3

Class: SchemaHelper

Hierarchy

  • SchemaHelper

Methods

databaseExists

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

Defined in packages/knex/src/schema/SchemaHelper.ts:178

Parameters:

NameType
connectionConnection
namestring

Returns: Promise<boolean>


finalizeTable

finalizeTable(table: TableBuilder, charset: string): void

Defined in packages/knex/src/schema/SchemaHelper.ts:16

Parameters:

NameType
tableTableBuilder
charsetstring

Returns: void


getColumns

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

Defined in packages/knex/src/schema/SchemaHelper.ts:93

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<any[]>


getCreateDatabaseSQL

getCreateDatabaseSQL(name: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:154

Parameters:

NameType
namestring

Returns: string


getDatabaseExistsSQL

getDatabaseExistsSQL(name: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:162

Parameters:

NameType
namestring

Returns: string


getDatabaseNotExistsError

getDatabaseNotExistsError(dbName: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:166

Parameters:

NameType
dbNamestring

Returns: string


getDefaultEmptyString

getDefaultEmptyString(): string

Defined in packages/knex/src/schema/SchemaHelper.ts:174

Returns: string


getDropDatabaseSQL

getDropDatabaseSQL(name: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:158

Parameters:

NameType
namestring

Returns: string


getEnumDefinitions

getEnumDefinitions(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<Dictionary>

Defined in packages/knex/src/schema/SchemaHelper.ts:81

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Dictionary>


getForeignKeys

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

Defined in packages/knex/src/schema/SchemaHelper.ts:76

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Dictionary>


getForeignKeysSQL

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

Defined in packages/knex/src/schema/SchemaHelper.ts:101

Parameters:

NameType
tableNamestring
schemaName?string

Returns: string


getIndexName

getIndexName(tableName: string, columns: string[], type: "index" | "unique" | "foreign"): string

Defined in packages/knex/src/schema/SchemaHelper.ts:108

Returns the default name of index for the given columns

Parameters:

NameType
tableNamestring
columnsstring[]
type"index" | "unique" | "foreign"

Returns: string


getIndexes

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

Defined in packages/knex/src/schema/SchemaHelper.ts:97

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Index[]>


getListTablesSQL

getListTablesSQL(): string

Defined in packages/knex/src/schema/SchemaHelper.ts:85

Returns: string


getManagementDbName

getManagementDbName(): string

Defined in packages/knex/src/schema/SchemaHelper.ts:170

Returns: string


getPrimaryKeys

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

Defined in packages/knex/src/schema/SchemaHelper.ts:72

Parameters:

NameType
connectionAbstractSqlConnection
indexesIndex[]
tableNamestring
schemaName?string

Returns: Promise<string[]>


getRenameColumnSQL

getRenameColumnSQL(tableName: string, from: Column, to: EntityProperty, idx?: number, quote?: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:89

Parameters:

NameTypeDefault value
tableNamestring-
fromColumn-
toEntityProperty-
idxnumber0
quotestring"""

Returns: string


getSchemaBeginning

getSchemaBeginning(charset: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:8

Parameters:

NameType
charsetstring

Returns: string


getSchemaEnd

getSchemaEnd(): string

Defined in packages/knex/src/schema/SchemaHelper.ts:12

Returns: string


getTypeDefinition

getTypeDefinition(prop: EntityProperty, types?: Dictionary<string[]>, lengths?: Dictionary<number>, allowZero?: boolean): string

Defined in packages/knex/src/schema/SchemaHelper.ts:20

Parameters:

NameTypeDefault value
propEntityProperty-
typesDictionary<string[]>{}
lengthsDictionary<number>{}
allowZerobooleanfalse

Returns: string


getTypeFromDefinition

getTypeFromDefinition(type: string, defaultType: string, types?: Dictionary<string[]>): string

Defined in packages/knex/src/schema/SchemaHelper.ts:62

Parameters:

NameType
typestring
defaultTypestring
types?Dictionary<string[]>

Returns: string


hasSameDefaultValue

PrivatehasSameDefaultValue(info: Column, prop: EntityProperty, defaultValues: Dictionary<string[]>): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:210

Parameters:

NameType
infoColumn
propEntityProperty
defaultValuesDictionary<string[]>

Returns: boolean


hasSameEnumDefinition

PrivatehasSameEnumDefinition(prop: EntityProperty, column: Column): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:247

Parameters:

NameType
propEntityProperty
columnColumn

Returns: boolean


hasSameIndex

PrivatehasSameIndex(prop: EntityProperty, column: Column): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:237

Parameters:

NameType
propEntityProperty
columnColumn

Returns: boolean


hasSameType

PrivatehasSameType(columnType: string, infoType: string, types: Dictionary<string[]>): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:191

Parameters:

NameType
columnTypestring
infoTypestring
typesDictionary<string[]>

Returns: boolean


indexForeignKeys

indexForeignKeys(): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:51

Returns: boolean


isImplicitIndex

isImplicitIndex(name: string): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:58

Implicit indexes will be ignored when diffing

Parameters:

NameType
namestring

Returns: boolean


isSame

isSame(prop: EntityProperty, column: Column, idx?: number, types?: Dictionary<string[]>, defaultValues?: Dictionary<string[]>): IsSame

Defined in packages/knex/src/schema/SchemaHelper.ts:36

Parameters:

NameTypeDefault value
propEntityProperty-
columnColumn-
idxnumber0
typesDictionary<string[]>{}
defaultValuesDictionary<string[]>{}

Returns: IsSame


mapForeignKeys

mapForeignKeys(fks: any[]): Dictionary

Defined in packages/knex/src/schema/SchemaHelper.ts:112

Parameters:

NameType
fksany[]

Returns: Dictionary


normalizeDefaultValue

normalizeDefaultValue(defaultValue: string, length: number, defaultValues?: Dictionary<string[]>): string | number

Defined in packages/knex/src/schema/SchemaHelper.ts:143

Parameters:

NameTypeDefault value
defaultValuestring-
lengthnumber-
defaultValuesDictionary<string[]>{}

Returns: string | number


processTypeWildCard

PrivateprocessTypeWildCard(prop: EntityProperty, lengths: Dictionary<number>, propType: string, allowZero: boolean, type: string): string

Defined in packages/knex/src/schema/SchemaHelper.ts:127

Parameters:

NameType
propEntityProperty
lengthsDictionary<number>
propTypestring
allowZeroboolean
typestring

Returns: string


supportsColumnAlter

supportsColumnAlter(): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:139

Returns: boolean


supportsSchemaConstraints

supportsSchemaConstraints(): boolean

Defined in packages/knex/src/schema/SchemaHelper.ts:47

Returns: boolean

Last updated on by Martin Adámek