Version: 4.3

Class: PostgreSqlSchemaHelper

Hierarchy

  • SchemaHelper

    PostgreSqlSchemaHelper

Methods

databaseExists

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

Inherited from MySqlSchemaHelper.databaseExists

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:40

Parameters:

NameType
connectionConnection
namestring

Returns: Promise<boolean>


finalizeTable

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

Inherited from PostgreSqlSchemaHelper.finalizeTable

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:8

Parameters:

NameType
tableTableBuilder
charsetstring

Returns: void


getColumns

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

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:74

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaNamestring

Returns: Promise<any[]>


getCreateDatabaseSQL

getCreateDatabaseSQL(name: string): string

Inherited from MySqlSchemaHelper.getCreateDatabaseSQL

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:34

Parameters:

NameType
namestring

Returns: string


getDatabaseExistsSQL

getDatabaseExistsSQL(name: string): string

Overrides MySqlSchemaHelper.getDatabaseExistsSQL

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:158

Parameters:

NameType
namestring

Returns: string


getDatabaseNotExistsError

getDatabaseNotExistsError(dbName: string): string

Overrides MySqlSchemaHelper.getDatabaseNotExistsError

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:162

Parameters:

NameType
dbNamestring

Returns: string


getDefaultEmptyString

getDefaultEmptyString(): string

Inherited from MySqlSchemaHelper.getDefaultEmptyString

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:39

Returns: string


getDropDatabaseSQL

getDropDatabaseSQL(name: string): string

Inherited from MySqlSchemaHelper.getDropDatabaseSQL

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:35

Parameters:

NameType
namestring

Returns: string


getEnumDefinitions

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

Overrides SqliteSchemaHelper.getEnumDefinitions

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:118

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Dictionary>


getForeignKeys

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

Inherited from MySqlSchemaHelper.getForeignKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:19

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaName?string

Returns: Promise<Dictionary>


getForeignKeysSQL

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

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:100

Parameters:

NameType
tableNamestring
schemaNamestring

Returns: string


getIndexName

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

Inherited from MySqlSchemaHelper.getIndexName

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:29

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[]>

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:88

Parameters:

NameType
connectionAbstractSqlConnection
tableNamestring
schemaNamestring

Returns: Promise<Index[]>


getIndexesSQL

PrivategetIndexesSQL(tableName: string, schemaName: string): string

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:170

Parameters:

NameType
tableNamestring
schemaNamestring

Returns: string


getListTablesSQL

getListTablesSQL(): string

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:68

Returns: string


getManagementDbName

getManagementDbName(): string

Overrides MySqlSchemaHelper.getManagementDbName

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:166

Returns: string


getPrimaryKeys

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

Inherited from MySqlSchemaHelper.getPrimaryKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:18

Parameters:

NameType
connectionAbstractSqlConnection
indexesIndex[]
tableNamestring
schemaName?string

Returns: Promise<string[]>


getRenameColumnSQL

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

Inherited from PostgreSqlSchemaHelper.getRenameColumnSQL

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:22

Parameters:

NameType
tableNamestring
fromColumn
toEntityProperty
idx?number
quote?string

Returns: string


getSchemaBeginning

getSchemaBeginning(charset: string): string

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:40

Parameters:

NameType
charsetstring

Returns: string


getSchemaEnd

getSchemaEnd(): string

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:44

Returns: string


getTypeDefinition

getTypeDefinition(prop: EntityProperty): string

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:48

Parameters:

NameType
propEntityProperty

Returns: string


getTypeFromDefinition

getTypeFromDefinition(type: string, defaultType: string): string

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:52

Parameters:

NameType
typestring
defaultTypestring

Returns: string


indexForeignKeys

indexForeignKeys(): boolean

Overrides MySqlSchemaHelper.indexForeignKeys

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:60

Returns: boolean


isImplicitIndex

isImplicitIndex(name: string): boolean

Overrides MySqlSchemaHelper.isImplicitIndex

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:64

Parameters:

NameType
namestring

Returns: boolean


isSame

isSame(prop: EntityProperty, column: Column, idx?: number): IsSame

Overrides void

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:56

Parameters:

NameType
propEntityProperty
columnColumn
idx?number

Returns: IsSame


mapForeignKeys

mapForeignKeys(fks: any[]): Dictionary

Inherited from MySqlSchemaHelper.mapForeignKeys

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:30

Parameters:

NameType
fksany[]

Returns: Dictionary


normalizeDefaultValue

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

Overrides SqliteSchemaHelper.normalizeDefaultValue

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:140

Parameters:

NameType
defaultValuestring
lengthnumber

Returns: string | number


supportsColumnAlter

supportsColumnAlter(): boolean

Inherited from MySqlSchemaHelper.supportsColumnAlter

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:32

Returns: boolean


supportsSchemaConstraints

supportsSchemaConstraints(): boolean

Inherited from MySqlSchemaHelper.supportsSchemaConstraints

Defined in packages/knex/dist/schema/SchemaHelper.d.ts:11

Returns: boolean

Object literals

DEFAULT_TYPE_LENGTHS

Static Readonly DEFAULT_TYPE_LENGTHS: object

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:25

Properties:

NameTypeValue
datenumber0
stringnumber255

DEFAULT_VALUES

Static Readonly DEFAULT_VALUES: object

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:30

Properties:

NameTypeValue
('now'::text)::timestamp(?) with time zonestring[]['current_timestamp(?)']
('now'::text)::timestamp(?) without time zonestring[]['current_timestamp(?)']
current_timestamp(?)string[]['current_timestamp(?)']
now()string[]['now()', 'current_timestamp']
null::character varyingstring[]['null']
null::timestamp with time zonestring[]['null']
null::timestamp without time zonestring[]['null']

TYPES

Static Readonly TYPES: object

Defined in packages/postgresql/src/PostgreSqlSchemaHelper.ts:6

Properties:

NameTypeValue
Bufferstring[]['bytea']
Datestring[]['timestamptz(?)', 'timestamp(?)', 'datetime(?)', 'timestamp with time zone', 'timestamp without time zone', 'datetimetz', 'time', 'date', 'timetz', 'datetz']
booleanstring[]['bool', 'boolean']
bufferstring[]['bytea']
datestring[]['timestamptz(?)', 'timestamp(?)', 'datetime(?)', 'timestamp with time zone', 'timestamp without time zone', 'datetimetz', 'time', 'date', 'timetz', 'datetz']
doublestring[]['double precision', 'float8']
enumstring[]['text']
floatstring[]['float']
jsonstring[]['jsonb', 'json']
numberstring[]['int4', 'integer', 'int2', 'int', 'float', 'float8', 'double', 'double precision', 'bigint', 'smallint', 'decimal', 'numeric', 'real']
objectstring[]['jsonb', 'json']
smallintstring[]['int2']
stringstring[]['varchar(?)', 'character varying', 'text', 'character', 'char', 'uuid', 'bigint', 'int8', 'enum']
textstring[]['text']
tinyintstring[]['int2']
uuidstring[]['uuid']
Last updated on by Martin Adámek