# Breaking Changes
# v5
# TL;DR
- Completely rewritten with TypeScript.
- New classes added and attributes moved to those new classes. (For example
Column.precisionmoved toTypeclass 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
SetandMaptoIndexableArraywhich is an extended array.IndexableArrayprovides all declarative functions of the array i.e.map,reduce,filteretc. 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.parentandConstraint.tablecontainTablewhere constraint is defined in. Previously they were containing referenced table for foreign key constraints.Constraintclass is now an abstract class.Column.typeis a class type instead of string.*.commentwas replacing[pg-structure][/pg-structure]. From now on, it returns raw comment. To get comment without data, use*.commentWithoutData.citextandhstoreare classified asUSER-DEFINED, because they are installed using extra modules.Removed properties:
*.description,*.descriptionData: Use*.comment,*.commentData.*.parentwhere not necessary: Use related attribute. For example:column.tableinstead ofcolumn.parent.parentcauses confusion for some objects. For example index object indexes table, but their parents areschemanottable:DROP INDEX public."some_index".Table.kind: Useinstanceof Tableandinstanceof Viewinstead.Constraint.type: Useinstanceof [ContsraintClass]instead.Column.domainName,Column.domainFullName,Column.domainFullCatalogName,Column.domainSchema: Usecolumn.type instanceof Domainandcolumn.typewhich returnsDomainsub class ofTypeclass if type is a domain.Column.arrayDimension,Column.arrayType: UseColumn.type.arrayDimension.Column.enumLabels,Column.enumValues: UseColumn.typewhich returnsEnumsub class if type is an enum.Column.precision,Column.scale: UseColumn.type.precisionandColumn.type.scale.Column.isAutoIncrement: UseColumn.isSerial.Column.foreignKeyConstraints: UseColumn.foreignKeysM2MRelation.nameFromDescription,M2ORelation.nameFromDescription,O2MRelation.nameFromDescription.M2MRelation.type,M2ORelation.type,O2MRelation.type: Useinstanceof M2MRelation,instanceof M2ORelation,instanceof O2MRelationinstead.constraintattributes in relations are renamed asforeignKey.
Changed properties
Schema.tablescontains only tables now. Previously it was containing tables and views combined. UseSchema.entitiesinstead.- All properties and methods which contain or return
Constraintinstances, now return related subclassesForeignKey,PrimaryKeyetc.
pg-structureload,savefunctions / features are removed.parseis removed. Usedeserializeinstead.serializeandtoStringfunctions are removed. Usedb.serialize()method instead.