Skip to main content
Version: 5.2

PostgreSqlSchemaHelper

Hierarchy

Index

Constructors

constructor

Properties

staticreadonlyDEFAULT_VALUES

DEFAULT_VALUES: { ('now'::text)::timestamp(?) with time zone: string[]; ('now'::text)::timestamp(?) without time zone: string[]; current_timestamp(?): string[]; now(): string[]; null::character varying: string[]; null::timestamp with time zone: string[]; null::timestamp without time zone: string[] } = ...

Type declaration

  • ('now'::text)::timestamp(?) with time zone: string[]
  • ('now'::text)::timestamp(?) without time zone: string[]
  • current_timestamp(?): string[]
  • now(): string[]
  • null::character varying: string[]
  • null::timestamp with time zone: string[]
  • null::timestamp without time zone: 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

    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): string
  • Parameters

    • tableName: string
    • column: Column

    Returns string

getChangeColumnCommentSQL

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

    Returns string

getChecks

  • Parameters

    Returns Promise<Check<unknown>[]>

getColumns

  • Parameters

    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

  • Parameters

    Returns Promise<Dictionary<string[]>>

getForeignKeys

  • Parameters

    Returns Promise<Dictionary<any>>

getForeignKeysSQL

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

    • tableName: string
    • schemaName: string

    Returns string

getIndexes

  • Parameters

    Returns Promise<Index[]>

getListTablesSQL

  • getListTablesSQL(): string
  • Returns string

getManagementDbName

  • getManagementDbName(): string
  • Returns string

getNamespaces

getPreAlterTable

  • Parameters

    Returns string

getPrimaryKeys

  • Parameters

    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

mapForeignKeys

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

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

    Returns Dictionary<any>

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