TypeORM v0.2.0 Release Notes
-
- ๐ completely refactored, improved and optimized persistence process and performance.
- โ removed cascade remove functionality, refactored how cascades are working.
- โ removed
cascadeRemove
option from relation options. - replaced
cascadeAll
withcascade: true
syntax from relation options. - replaced
cascadeInsert
withcascade: ["insert"]
syntax from relation options. - โก๏ธ replaced
cascadeUpdate
withcascade: ["update"]
syntax from relation options. - now when one-to-one or many-to-one relation is loaded and its not set (set to null) ORM returns you entity with relation set to
null
instead ofundefined property
as before. - now relation id can be set directly to relation, e.g.
Post { @ManyToOne(type => Tag) tag: Tag|number }
withpost.tag = 1
usage. - ๐ now you can disable persistence on any relation by setting
@OneToMany(type => Post, post => tag, { persistence: false })
. This can dramatically improve entity save performance. - 0๏ธโฃ
loadAllRelationIds
method ofQueryBuilder
now accepts list of relation paths that needs to be loaded, alsodisableMixedMap
option is now by default set to false, but you can enable it via new method parameteroptions
- ๐ now
returning
andoutput
statements ofInsertQueryBuilder
support array of columns as argument - ๐ now when many-to-many and one-to-many relation set to
null
all items from that relation are removed, just like it would be set to empty array - ๐ fixed issues with relation update from one-to-one non-owner side
- โก๏ธ now version column is updated on the database level, not by ORM anymore
- โก๏ธ now created date and update date columns is set on the database level, not by ORM anymore (e.g. using
CURRENT_TIMESTAMP
as a default value) - โก๏ธ now
InsertQueryBuilder
,UpdateQueryBuilder
andDeleteQueryBuilder
automatically update entities after execution. This only happens if real entity objects are passed. Some databases (like mysql and sqlite) requires a separate query to perform this operation. โก๏ธ If you want to disable this behavior usequeryBuilder.updateEntity(false)
method. โก๏ธ This feature is convenient for users who have uuid, create/update date, version columns or columns with DEFAULT value set. - โก๏ธ now
InsertQueryBuilder
,UpdateQueryBuilder
andDeleteQueryBuilder
call subscribers and listeners. You can disable this behavior by settingqueryBuilder.callListeners(false)
method. - ๐
Repository
andEntityManager
method.findOneById
is deprecated and will be removed in next 0.3.0 version. ๐ UsefindOne(id)
method instead now. - ๐
InsertQueryBuilder
now returnsInsertResult
which contains extended information and metadata about runned query - ๐
UpdateQueryBuilder
now returnsUpdateResult
which contains extended information and metadata about runned query - ๐
DeleteQueryBuilder
now returnsDeleteResult
which contains extended information and metadata about runned query - โก๏ธ now insert / update / delete queries built with QueryBuilder can be wrapped into a transaction using
useTransaction(true)
method of the QueryBuilder. - โก๏ธ
insert
,update
anddelete
methods ofQueryRunner
now useInsertQueryRunner
,UpdateQueryRunner
andDeleteQueryRunner
inside - โ removed deprecated
removeById
,removeByIds
methods - โ removed
deleteById
method - usedelete(id)
method instead now - โ removed
updateById
method - useupdate(id)
method instead now - โฌ๏ธ changed
snakeCase
utility - check table names after upgrading - โ added ability to disable transaction in
save
andremove
operations - โ added ability to disable listeners and subscribers in
save
andremove
operations - โ added ability to save and remove objects in chunks
- โ added ability to disable entity reloading after insertion and updation
- class table inheritance functionality has been completely dropped
- ๐ single table inheritance functionality has been fixed
@SingleEntityChild
has been renamed to@ChildEntity
- ๐
@DiscriminatorValue
has been removed, instead parameter in@ChildEntity
must be used, e.g.@ChildEntity("value")
- ๐
@DiscriminatorColumn
decorator has been removed, use@TableInheritance
options instead now - ๐
skipSync
in entity options has been renamed tosynchronize
. Now if it set to false schema synchronization for the entity will be disabled. 0๏ธโฃ By default its true. - now array initializations for relations are forbidden and ORM throws an error if there are entities with initialized relation arrays.
- ๐
@ClosureEntity
decorator has been removed. Instead@Entity
+@Tree("closure-table")
must be used - โ added support for nested set and materialized path tree hierarchy patterns
- ๐ฅ breaking change on how array parameters work in queries - now instead of (:param) new syntax must be used (:...param). ๐ This fixed various issues on how real arrays must work
- ๐ changed the way how entity schemas are created (now more type-safe), now interface EntitySchema is a class
- โ added
@Unique
decorator. Accepts custom unique constraint name and columns to be unique. Used only on as composite unique constraint, on table level. E.g.@Unique("uq_id_name", ["id", "name"])
- โ added
@Check
decorator. Accepts custom check constraint name and expression. Used only on as composite check constraint, on table level. E.g.@Check("chk_name", "name <> 'asd'")
- ๐ fixed
Oracle
issues, now it will be fully maintained as other drivers - implemented migrations functionality in all drivers
- โช CLI commands changed from
migrations:create
,migrations:generate
,migrations:revert
andmigrations:run
tomigration:create
,migration:generate
,migration:revert
andmigration:run
- ๐ changed the way how migrations work (more info in #1315). Now migration table contains
id
column with auto-generated keys, you need to re-create migrations table or add new column manually. - entity schemas syntax was changed
- โฌ๏ธ dropped support for WebSql and SystemJS
- ๐
@Index
decorator now acceptssynchronize
option. This option need to avoid deleting custom indices which is not created by TypeORM - ๐ new flag in relation options was introduced:
{ persistence: false }
. You can use it to prevent any extra queries for relations checks - โ added support for
UNSIGNED
andZEROFILL
column attributes in MySQL - โ added support for generated columns in MySQL
- โ added support for
ON UPDATE
column option in MySQL - โ added
SPATIAL
andFULLTEXT
index options in MySQL - โ added
hstore
andenum
column types support in Postgres - โ added range types support in Postgres
- 0๏ธโฃ TypeORM now uses
{ "supportBigNumbers": true, "bigNumberStrings": true }
options by default fornode-mysql
- Integer data types in MySQL now accepts
width
option instead oflength
- junction tables now have
onDelete: "CASCADE"
attribute on their foreign keys ancestor
anddescendant
columns in ClosureTable marked as primary keys- unique index now will be created for the join columns in
ManyToOne
andOneToOne
relations