PostgreSqlSchemaHelper
Hierarchy
- SchemaHelper
- PostgreSqlSchemaHelper
Index
Constructors
Properties
Accessors
Methods
- alterTable
- alterTableColumn
- alterTableComment
- append
- appendComments
- castColumn
- createCheck
- createForeignKey
- createIndex
- createMaterializedView
- createTable
- createTableColumn
- createView
- databaseExists
- disableForeignKeysSQL
- dropConstraint
- dropForeignKey
- dropIndex
- dropMaterializedViewIfExists
- dropTableIfExists
- dropViewIfExists
- enableForeignKeysSQL
- finalizeTable
- getAddColumnsSQL
- getAllChecks
- getAllColumns
- getAllForeignKeys
- getAllIndexes
- getAlterNativeEnumSQL
- getChangeColumnCommentSQL
- getCreateDatabaseSQL
- getCreateIndexSQL
- getCreateNamespaceSQL
- getCreateNativeEnumSQL
- getDatabaseExistsSQL
- getDatabaseNotExistsError
- getDefaultEmptyString
- getDropColumnsSQL
- getDropDatabaseSQL
- getDropIndexSQL
- getDropNamespaceSQL
- getDropNativeEnumSQL
- getListMaterializedViewsSQL
- getListTablesSQL
- getListViewsSQL
- getManagementDbName
- getNamespaces
- getNativeEnumDefinitions
- getPostAlterTable
- getPreAlterTable
- getPrimaryKeys
- getReferencedTableName
- getRenameColumnSQL
- getRenameIndexSQL
- getSchemaBeginning
- getSchemaEnd
- getTablesGroupedBySchemas
- hasNonDefaultPrimaryKeyName
- inferLengthFromColumnType
- loadInformationSchema
- loadMaterializedViews
- loadViews
- mapForeignKeys
- normalizeDefaultValue
- refreshMaterializedView
- splitTableName
- supportsSchemaConstraints
Constructors
constructor
Parameters
platform: AbstractSqlPlatform
Returns PostgreSqlSchemaHelper
Properties
staticreadonlyDEFAULT_VALUES
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[]
Accessors
inheritedoptions
Returns { createForeignKeyConstraints?: boolean; defaultDeleteRule?: cascade | no action | set null | set default | restrict; defaultUpdateRule?: cascade | no action | set null | set default | restrict; disableForeignKeys?: boolean; ignoreSchema?: string[]; managementDbName?: string; skipColumns?: Dictionary<(string | RegExp)[]>; skipTables?: (string | RegExp)[] }
optionalcreateForeignKeyConstraints?: boolean
optionaldefaultDeleteRule?: cascade | no action | set null | set default | restrict
Default ON DELETE rule for foreign keys. When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
optionaldefaultUpdateRule?: cascade | no action | set null | set default | restrict
Default ON UPDATE rule for foreign keys. When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
optionaldisableForeignKeys?: boolean
Try to disable foreign key checks during schema operations.
optionalignoreSchema?: string[]
Schema names to ignore when comparing schemas.
optionalmanagementDbName?: string
Database name to use for management operations (e.g., creating/dropping databases).
optionalskipColumns?: Dictionary<(string | RegExp)[]>
Column names or patterns to skip during schema generation, keyed by table name.
optionalskipTables?: (string | RegExp)[]
Table names or patterns to skip during schema generation.
Methods
inheritedalterTable
Parameters
diff: TableDifference
optionalsafe: boolean
Returns string[]
inheritedalterTableColumn
Parameters
column: Column
table: DatabaseTable
changedProperties: Set<string>
Returns string[]
alterTableComment
Parameters
table: DatabaseTable
optionalcomment: string
Returns string
inheritedappend
Parameters
array: string[]
sql: string | string[]
pad: boolean = false
Returns void
appendComments
Parameters
table: DatabaseTable
Returns string[]
castColumn
Parameters
name: string
type: string
Returns string
inheritedcreateCheck
Parameters
table: DatabaseTable
check: CheckDef<unknown>
Returns string
inheritedcreateForeignKey
Parameters
table: DatabaseTable
foreignKey: ForeignKey
alterTable: boolean = true
inline: boolean = false
Returns string
inheritedcreateIndex
Parameters
index: IndexDef
table: DatabaseTable
createPrimary: boolean = false
Returns string
createMaterializedView
Parameters
name: string
schema: undefined | string
definition: string
withData: boolean = true
Returns string
inheritedcreateTable
Parameters
table: DatabaseTable
optionalalter: boolean
Returns string[]
createTableColumn
Parameters
column: Column
table: DatabaseTable
Returns undefined | string
inheritedcreateView
Parameters
name: string
schema: undefined | string
definition: string
Returns string
inheriteddatabaseExists
Parameters
connection: Connection
name: string
Returns Promise<boolean>
disableForeignKeysSQL
Returns string
inheriteddropConstraint
Parameters
table: string
name: string
Returns string
dropForeignKey
Parameters
tableName: string
constraintName: string
Returns string
dropIndex
Parameters
table: string
index: IndexDef
oldIndexName: string = index.keyName
Returns string
dropMaterializedViewIfExists
Parameters
name: string
optionalschema: string
Returns string
inheriteddropTableIfExists
Parameters
name: string
optionalschema: string
Returns string
inheriteddropViewIfExists
Parameters
name: string
optionalschema: string
Returns string
enableForeignKeysSQL
Returns string
inheritedfinalizeTable
Parameters
table: DatabaseTable
charset: string
optionalcollate: string
Returns string
inheritedgetAddColumnsSQL
Parameters
table: DatabaseTable
columns: Column[]
Returns string[]
getAllChecks
Parameters
connection: AbstractSqlConnection
tablesBySchemas: Map<undefined | string, Table[]>
Returns Promise<Dictionary<CheckDef<unknown>[]>>
getAllColumns
Parameters
connection: AbstractSqlConnection
tablesBySchemas: Map<undefined | string, Table[]>
optionalnativeEnums: Dictionary<{ items: string[]; name: string; schema?: string }>
Returns Promise<Dictionary<Column[]>>
getAllForeignKeys
Parameters
connection: AbstractSqlConnection
tablesBySchemas: Map<undefined | string, Table[]>
Returns Promise<Dictionary<Dictionary<ForeignKey>>>
getAllIndexes
Parameters
connection: AbstractSqlConnection
tables: Table[]
Returns Promise<Dictionary<IndexDef[]>>
getAlterNativeEnumSQL
Parameters
name: string
optionalschema: string
optionalvalue: string
optionalitems: string[]
optionaloldItems: string[]
Returns string
getChangeColumnCommentSQL
Parameters
tableName: string
to: Column
optionalschemaName: string
Returns string
getCreateDatabaseSQL
Parameters
name: string
Returns string
inheritedgetCreateIndexSQL
Parameters
tableName: string
index: IndexDef
Returns string
inheritedgetCreateNamespaceSQL
Parameters
name: string
Returns string
getCreateNativeEnumSQL
Parameters
name: string
values: unknown[]
optionalschema: string
Returns string
getDatabaseExistsSQL
Parameters
name: string
Returns string
getDatabaseNotExistsError
Parameters
dbName: string
Returns string
inheritedgetDefaultEmptyString
Returns string
inheritedgetDropColumnsSQL
Parameters
tableName: string
columns: Column[]
optionalschemaName: string
Returns string
inheritedgetDropDatabaseSQL
Parameters
name: string
Returns string
inheritedgetDropIndexSQL
Parameters
tableName: string
index: IndexDef
Returns string
inheritedgetDropNamespaceSQL
Parameters
name: string
Returns string
getDropNativeEnumSQL
Parameters
name: string
optionalschema: string
Returns string
getListMaterializedViewsSQL
Returns string
getListTablesSQL
Returns string
getListViewsSQL
Returns string
getManagementDbName
Returns string
getNamespaces
Parameters
connection: AbstractSqlConnection
Returns Promise<string[]>
getNativeEnumDefinitions
Parameters
connection: AbstractSqlConnection
schemas: string[]
Returns Promise<Dictionary<{ items: string[]; name: string; schema?: string }>>
getPostAlterTable
Parameters
tableDiff: TableDifference
safe: boolean
Returns string[]
getPreAlterTable
Parameters
tableDiff: TableDifference
safe: boolean
Returns string[]
inheritedgetPrimaryKeys
Parameters
connection: AbstractSqlConnection
indexes: IndexDef[] = []
tableName: string
optionalschemaName: string
Returns Promise<string[]>
inheritedgetReferencedTableName
Parameters
referencedTableName: string
optionalschema: string
Returns string
inheritedgetRenameColumnSQL
Parameters
tableName: string
oldColumnName: string
to: Column
optionalschemaName: string
Returns string
getRenameIndexSQL
Parameters
tableName: string
index: IndexDef
oldIndexName: string
Returns string[]
getSchemaBeginning
Parameters
charset: string
optionaldisableForeignKeys: boolean
Returns string
inheritedgetSchemaEnd
Parameters
optionaldisableForeignKeys: boolean
Returns string
inheritedgetTablesGroupedBySchemas
inheritedhasNonDefaultPrimaryKeyName
Parameters
table: DatabaseTable
Returns boolean
inferLengthFromColumnType
Parameters
type: string
Returns undefined | number
loadInformationSchema
Parameters
schema: DatabaseSchema
connection: AbstractSqlConnection
tables: Table[]
optionalschemas: string[]
Returns Promise<void>
loadMaterializedViews
Parameters
schema: DatabaseSchema
connection: AbstractSqlConnection
optionalschemaName: string
Returns Promise<void>
loadViews
Parameters
schema: DatabaseSchema
connection: AbstractSqlConnection
Returns Promise<void>
inheritedmapForeignKeys
Parameters
fks: any[]
tableName: string
optionalschemaName: string
Returns Dictionary
normalizeDefaultValue
Parameters
defaultValue: string
length: number
Returns string | number
refreshMaterializedView
Parameters
name: string
optionalschema: string
concurrently: boolean = false
Returns string
inheritedsplitTableName
Parameters
name: string
skipDefaultSchema: boolean = false
Returns [undefined | string, string]
inheritedsupportsSchemaConstraints
Returns boolean
Generate foreign key constraints.