# Breaking Changes
# v5
# TL;DR
- Completely rewritten with TypeScript.
- New classes added and attributes moved to those new classes. (For example
Column.precision
moved toType
class and should be accesedColumn.type.precision
) - If you find any mistakes in docs, please open a case in GitHub (opens new window)
# New Features
- Rewritten in TypeScript from scratch.
- All collection methods migrated from
Set
andMap
toIndexableArray
which is an extended array.IndexableArray
provides all declarative functions of the array i.e.map
,reduce
,filter
etc. in addition of keeping collection order and indexed lookup support forget
. - Added abstract classes:
DBObject
,Entity
,Relation
. - Added classes:
View
,Domain
,Type
,Check
,ForeignKey
,PrimaryKey
,Enum
. - Added properties:
Schema.views
,Schema.entities
.
# Breaking Changes
IMPORTANT:
Constraint.parent
andConstraint.table
containTable
where constraint is defined in. Previously they were containing referenced table for foreign key constraints.Constraint
class is now an abstract class.Column.type
is a class type instead of string.*.comment
was replacing[pg-structure][/pg-structure]
. From now on, it returns raw comment. To get comment without data, use*.commentWithoutData
.citext
andhstore
are classified asUSER-DEFINED
, because they are installed using extra modules.Removed properties:
*.description
,*.descriptionData
: Use*.comment
,*.commentData
.*.parent
where not necessary: Use related attribute. For example:column.table
instead ofcolumn.parent
.parent
causes confusion for some objects. For example index object indexes table, but their parents areschema
nottable
:DROP INDEX public."some_index"
.Table.kind
: Useinstanceof Table
andinstanceof View
instead.Constraint.type
: Useinstanceof [ContsraintClass]
instead.Column.domainName
,Column.domainFullName
,Column.domainFullCatalogName
,Column.domainSchema
: Usecolumn.type instanceof Domain
andcolumn.type
which returnsDomain
sub class ofType
class if type is a domain.Column.arrayDimension
,Column.arrayType
: UseColumn.type.arrayDimension
.Column.enumLabels
,Column.enumValues
: UseColumn.type
which returnsEnum
sub class if type is an enum.Column.precision
,Column.scale
: UseColumn.type.precision
andColumn.type.scale
.Column.isAutoIncrement
: UseColumn.isSerial
.Column.foreignKeyConstraints
: UseColumn.foreignKeys
M2MRelation.nameFromDescription
,M2ORelation.nameFromDescription
,O2MRelation.nameFromDescription
.M2MRelation.type
,M2ORelation.type
,O2MRelation.type
: Useinstanceof M2MRelation
,instanceof M2ORelation
,instanceof O2MRelation
instead.constraint
attributes in relations are renamed asforeignKey
.
Changed properties
Schema.tables
contains only tables now. Previously it was containing tables and views combined. UseSchema.entities
instead.- All properties and methods which contain or return
Constraint
instances, now return related subclassesForeignKey
,PrimaryKey
etc.
pg-structure
load
,save
functions / features are removed.parse
is removed. Usedeserialize
instead.serialize
andtoString
functions are removed. Usedb.serialize()
method instead.