CHANGELOG
0.3.15 (2023-04-15)
Bug Fixes
- make cache optional fields optional (#9942) (159c60a)
- prevent unique index identical to primary key (all sql dialects) (#9940) (51eecc2)
- SelectQueryBuilder builds incorrectly escaped alias in Oracle when used on entity with composite key (#9668) (83c6c0e)
Features
0.3.14 (2023-04-09)
Bug Fixes
- drop xml & yml connection option support. Addresses security issues in underlying dependency (#9930) (7dac12c)
Features
0.3.13 (2023-04-06)
Bug Fixes
- firstCapital=true not working in camelCase() function (f1330ad)
- handles "query" relation loading strategy for TreeRepositories (#9680) (a11809e), closes #9673
- improve EntityNotFound error message in QueryBuilder.findOneOrFail (#9872) (f7f6817)
- loading tables with fk in sqlite query runner (#9875) (4997da0), closes #9266
- prevent foreign key support during migration batch under sqlite (#9775) (197cc05), closes #9770
- proper default value on generating migration when default value is a function calling [Postgres] (#9830) (bebba05)
- react-native doesn't properly work in ESM projects because of circular dependency (#9765) (099fcd9)
- resolve issues for mssql migration when simple-enum was changed (cb154d4), closes #7785 #9457 #7785 #9457
- resolves issue with mssql column recreation (#9773) (07221a3), closes #9399
- transform values for FindOperators #9381 (#9777) (de1228d), closes #9816
- use forward slashes when normalizing path (#9768) (58fc088), closes #9766
- use object create if entity skip constructor is set (#9831) (a868979)
Features
- add support for json datatype for sqlite (#9744) (4ac8c00)
- add support for STI on EntitySchema (#9834) (bc306fb), closes #9833
- allow type FindOptionsOrderValue for order by object property (#9895) (#9896) (0814970)
- Broadcast identifier for removed related entities (#9913) (f530811)
- leftJoinAndMapOne and innerJoinAndMapOne map result to entity (#9354) (947ffc3)
0.3.12 (2023-02-07)
Bug Fixes
- allow to pass ObjectLiteral in mongo find where condition (#9632) (4eda5df), closes #9518
- DataSource.setOptions doesn't properly update the database in the drivers (#9635) (a95bed7)
- Fix grammar error in no migrations found log (#9754) (6fb2121)
- improved
FindOptionsWhere
behavior with union types (#9607) (7726f5a) - Incorrect enum default value when table name contains dash character (#9685) (b3b0c11)
- incorrect sorting of entities with multi-inheritances (#9406) (54ca9dd)
- make sure "require" is defined in the environment (1a9b9fb)
- materialized hints support for cte (#9605) (67973b4)
- multiple select queries during db sync in sqlite (#9639) (6c928a4)
- overriding caching settings when alwaysEnabled is true (#9731) (4df969e)
- redundant Unique constraint on primary join column in Postgres (#9677) (b8704f8)
- remove unnecessary .js extension in imports (#9713) (6b37e38)
- resolve issue with "simple-enum" synchronization in SQLite (#9716) (c77c43e), closes #9715
- sql expression when
where
parameter is empty array (#9691) (7df2ccf), closes #9690 - synchronizing View with schema broken for oracle (#9602) (18b659d)
Features
- add find operator json contains (#9665) (d2f37f6)
- allow mysql2 v3 as peerDependency (#9747) (6c9010e), closes #9714
- naming strategy for legacy Oracle (#9703) (0eb7441)
- support busy_timeout param parameter for sqlite (#9623) (8668c29)
- support enableWal for the better-sqlite3 driver (#9619) (8731858)
- support for SQL aggregate functions SUM, AVG, MIN, and MAX to the Repository API (#9737) (7d1f1d6)
- support time travel queries, upsert, enums, spatial types in cockroachdb (#9128) (defb409), closes #9068 #8532 #8532 #9199
- update mssql dependency and other dependencies as well (#9763) (4555211)
0.3.11 (2022-12-03)
Fixes
- boolean parameter escape in SQLiteDriver (#9400) (4a36d0e), closes #1981
- cacheId not used when loading relations with take (#9469) (93e6b3d)
- correctly return insertId for react-native (#9554) (97fae63)
- disable transactionSupport option for CordovaDriver (#9391) (53fad8f)
- explicitly define property for entity relation as enumerable (#9437) (85fa9c6), closes #6631
- fix ormUtils prototype check crashing on null prototype (#9517) (19536ed)
- fixed outdated
init
command (#9422) (0984307) - left instead of inner join for where or + optional relations (#9516) (d490793)
- Mark array arguments to find operators as read-only (#9474) (6eb674b)
- pass fake flag to undoLastMigration (#9562) (2458ac7), closes #9561
- resolve issue with migrations and unsigned int columns in aurora-data-api (#9478) (38e0eff), closes #9477
- resolve nameless TableForeign on drop foreign key (#9460) (efb4168), closes #9432
- synchronize with typeorm_metadata table only if needed (#9175) (cdabaa3), closes #9173 #9173 #9173
- the mpath is incorrect when the parent of the tree entity is null (#9535) (658604d)
- typings for Repository.extend function (#9396) (f07fb2c)
Features
- "And" operator in FindOptions (#9489) (fc3b4f8), closes #3113
- add id in migrate:show command logging (#9475) (71efa8e)
- add Open DB Flags and URI DB Name in SQLite (#9468) (73148c9)
- add parseInt8 option to postgres driver. Closes #9341 (#9435) (2473ff0)
- Add synchronize to @JoinTable (#9442) (93e14a9), closes #3443
- added opaque types support over primitives in find-options (#9560) (4ec04fa)
- allow for partial index conditions for on conflict statments in postgres (#8971) (2c54381)
- allow peerDependency of better-sqlite3 version 8.x.x (#9564) (26107e6), closes #9563
- allow per-migration control over transaction behavior (#9459) (6ba48bd), closes #7087
- implement exists query method (#9303) (598e269), closes #2815
- index support for materialized views of PostgreSQL (#9414) (1cb738a)
- migration:generate successful exit the process with zero code (#9288) (f215e2d)
- new virtual column decorator (#9339) (d305e5f), closes #9323 typeorm#9323 typeorm#9323 typeorm#9323 typeorm#9323
- upsert options conflictPaths as Entity keys (#9365) (b282428)
0.3.10 (2022-09-19)
Bug Fixes
- "Cannot commit, no transaction is active" error in sql.js (#9234) (749809a), closes #9100
- add missing support for primaryKeyConstraintName property in EntitySchema (cc63961)
- malformed query when selecting deeply nested embedded entities (#9273) (83f7b88)
- prototype pollution issue (e3aac27)
- typescript 4.8 type issues #9331 (#9357) (a1960e1)
- Update RelationIdLoader to use DriverUtils.getAlias (#9380) (a917d65), closes #9379
Features
- orphanedRowAction=disabled (rebase of PR 8285) (#8678) (de15df1)
- sqlite - deferrable options for foreign keys (#9360) (773a4fe)
- unify Pool max connection size in supported Drivers (#9305) (48976c2), closes #3388
- update db image versions in docker compose (#9367) (f24b262), closes #9326
0.3.9 (2022-08-28)
0.3.8 (2022-08-26)
Bug Fixes
- allow space and no-space syntaxes for SQLite constraints (#9238) (bb07244), closes #9237
- allow where IsNull for ManyToOne relations (#9031) (72728f1), closes #8890
- change postgres driver version checking query (#9319) (c4f4650), closes #9318 #9318
- don't use temporary table name to create foreign key, unique, check constraint with SQLite (#9185) (e519910), closes #9176
- dropIndex now works when providing a tableIndex without name (#8937) (de8aaac)
- entity manager remove using entity schemas (#9221) (f045536)
- find query mongodb properly with @DeleteDateColumn() (#9262) (e49d0c8)
- handle inherited relations insert order (#9242) (14dfadb), closes #9241
- handle inherited relations insert order (#9321) (3671887), closes #9242 #9241
- pass error to pgpool release (#9209) (eb8f0c6), closes #7792 #5112
- QueryBuilder update handles Date objects wrong on a ManyToOne relationship (#8748) (88d0ced), closes #8747
- resolve FindOptionsOrder.nulls to allow FIRST/LAST in uppercase (#8978) (5e5abbd), closes #8970
- resolve issues with new synonymous for GeometryCollection type in MySQL 8 (#8927) (5ebc626)
- sqlite temporary tables now honor withoutRowid (#8431) (b8d04dc), closes #8430
- support async import for DataSource in CLI #8914 (#8917) (15f90e0)
- update date utils to parse year correctly for years 1-999 (#9236) (72a0147), closes #9230
Features
- add fake migrations running and reverting (#8976) (340ab67), closes #6195
- add setOnLocked for SKIP LOCKED and NOWAIT (#9317) (68e8f22)
- add support for non-generated columns with uuid_generate_v4() default (#9065) (dadb658), closes #9063
- new mssql option appName (#9213) (51a0ebe)
0.3.7 (2022-06-29)
Bug Fixes
- add missing
enumName
support for EntitySchema (#9024) (676fd1b) - add missing connect call on RedisQueryResultCache connect (#8894) (7dfb69f)
- add SET TRANSACTION AUTOCOMMIT DDL statements (SAP HANA) (#9020) (cac648e)
- call dataSource.destroy() only on initialized dataSource in CLI commands (#9146) (a100a7a)
- expo infinite loop on SAVEPOINT (#8984) (ec23922)
- fixes recursive document to entity attributes mapping (#9050) (40155d6), closes #9049
- log command error prior to calling destroy (#9135) (bf17381)
- make soft-remove and recover events importable from index (#9110) (e296126), closes #9108
- migration successful now displays name of the migration file (#8904) (49cbe23)
- release newly created runner when no runner provided in DbQueryResultCache (#8969) (ec05f1d), closes #4866
- resolve cli init peer dependency issues (#8977) (f7578d4), closes #8975
- resolve ESM module declaration file correctly (#9097) (506133e)
- support for TypeScript 4.8 (#9106) (d924b70), closes /github.com/microsoft/TypeScript/issues/49461#issuecomment-1154443477
- update mssql peerDependency (#8887) (9adab34)
- wrong entity transform of relation id when referenced column is a primary key (#8959) (6e888dd)
Features
- add
for_key_share
("FOR KEY SHARE") lock mode for postgres driver (#8879) (4687be8), closes #8878 - add nativeBinding option to better-sqlite3 driver (#9157) (bcdddc3)
- add spanner as a db option for the init command (#9121) (e61cade)
- allow explicitly named primary keys, foreign keys, and indices (#8900) (78df84c), closes #1355
- Cloud Spanner support (#8730) (62518ae)
- fix issues with generated columns and add support in other drivers (#8806) (0418ebc), closes #8761
- implement support for relationids in entity schemas (#9129) (e24cced)
- support TS 4.7+ node16/nodenext module mode (#9043) (862a402)
- upgrade ioredis to v5 (#8997) (723f1e5)
Performance Improvements
- don't recompile escapeRegExp for every query (#8956) (189592c), closes #8955
- partially lift matching from regexp to js (#9032) (bbdc20f), closes #3857 #8955 #8956 /github.com/typeorm/typeorm/issues/3857#issuecomment-699505893
0.3.6 (2022-04-12)
Features
- add
for_key_share
("FOR KEY SHARE") lock mode for postgres driver (#8879) (4687be8), closes #8878 - new driver: Cloud Spanner (#8730) (62518ae)
0.3.5 (2022-04-05)
Bug Fixes
.save
repository method not returning generated uuids for aurora-postgres (#8825) (ed06f4c)- allow hstore type to use transformers in driver postgres (#8823) (b1a0107)
- broken shebang parameters of
cli-ts-node-commonjs
andcli-ts-node-esm
on some linux distros (#8821) (c5dfc11), closes #8818 - find select object api should support false values #8796 (#8807) (9ac8e9e)
- resolve missing ConnectionOptions export in index.ts (#8850) (1693a17), closes #8837
- save correct discriminator with STI (#8819) (9d1e246), closes #2927
- Update DeepPartial for usage of generics with Repository class (#8817) (8ba742e)
- fixed issue with
typeorm init
command (#8820)
0.3.4 (2022-03-26)
Bug Fixes
- BaseEntity.reload method regression and made
findOne
to throw error on missing conditions in runtime (#8801) (ee8c1ec) - improve DeepPartial recursion (#8732) (0494008), closes #8681
- missing timestamp in created migrations filenames (#8802) (ceee439)
- PoolConnection leaked by MysqlDriver (#8803) (d2cfd22)
- remove console.log calls from SelectQueryBuilder (#8795) (54c7db4), closes #8792
- stop crashing when redis is offline and ignoreErrors on cache options is set (#8725) (edc39d1)
Features
- add support for insert with alias (#4003) (#8791) (4b37030)
- applicationName parameter for CockroachDB (#8800) (79b7f5c)
0.3.3 (2022-03-23)
Bug Fixes
- improve initialization of custom repository (#8782) (52a641c)
- resolve entities correctly in datasource when globs are specified (#8778) (a641c5d)
Features
0.3.2 (2022-03-22)
Bug Fixes
Features
- add typeorm CLI variations that include
ts-node
(#8776) (05fc744) - allows user to specify which mysql package should be used (#8771) (35106df)
Reverts
0.3.1 (2022-03-21)
Bug Fixes
Features
BREAKING CHANGES
- we do not call JSON.stringify() to json/jsonb column types in Postgres. Instead, we delegate value directly to underlying pg driver. This is a correct way of handling jsons.
- array: true must be explicitly defined for array json/jsonb values
- strings being JSON-stringified must be manually escaped
0.3.0 (2022-03-17)
Changes in the version includes changes from the next
branch and typeorm@next
version.
They were pending their migration from 2018. Finally, they are in the master branch and master version.
Features
compilation
target
now ises2020
. This requires Node.JS version14+
TypeORM now properly works when installed within different node_modules contexts (often happen if TypeORM is a dependency of another library or TypeORM is heavily used in monorepo projects)
Connection
was renamed toDataSource
. OldConnection
is still there, but now it's deprecated. It will be completely removed in next version. New API:
export const dataSource = new DataSource({
// ... options ...
})
// load entities, establish db connection, sync schema, etc.
await dataSource.connect()
Previously, you could use new Connection()
, createConnection()
, getConnectionManager().create()
, etc.
They all deprecated in favour of new syntax you can see above.
New way gives you more flexibility and simplicity in usage.
- new custom repositories syntax:
export const UserRepository = myDataSource.getRepository(UserEntity).extend({
findUsersWithPhotos() {
return this.find({
relations: {
photos: true
}
})
}
})
Old ways of custom repository creation were dropped.
added new option on relation load strategy called
relationLoadStrategy
. Relation load strategy is used on entity load and determines how relations must be loaded when you query entities and their relations from the database. Used onfind*
methods andQueryBuilder
. Value can be set tojoin
orquery
.join
- loads relations using SQLJOIN
expressionquery
- executes separate SQL queries for each relation
Default is join
, but default can be set in ConnectionOptions
:
createConnection({
/* ... */
relationLoadStrategy: "query"
})
Also, it can be set per-query in find*
methods:
userRepository.find({
relations: {
photos: true
}
})
And QueryBuilder:
userRepository
.createQueryBuilder()
.setRelationLoadStrategy("query")
For queries returning big amount of data, we recommend to use query
strategy,
because it can be a more performant approach to query relations.
- added new
findOneBy
,findOneByOrFail
,findBy
,countBy
,findAndCountBy
methods toBaseEntity
,EntityManager
andRepository
:
const users = await userRepository.findBy({
name: "Michael"
})
Overall find*
and count*
method signatures where changed, read the "breaking changes" section for more info.
- new
select
type signature inFindOptions
(used infind*
methods):
userRepository.find({
select: {
id: true,
firstName: true,
lastName: true,
}
})
Also, now it's possible to specify select columns of the loaded relations:
userRepository.find({
select: {
id: true,
firstName: true,
lastName: true,
photo: {
id: true,
filename: true,
album: {
id: true,
name: true,
}
}
}
})
- new
relations
type signature inFindOptions
(used infind*
methods):
userRepository.find({
relations: {
contacts: true,
photos: true,
}
})
To load nested relations use a following signature:
userRepository.find({
relations: {
contacts: true,
photos: {
album: true,
},
}
})
- new
order
type signature inFindOptions
(used infind*
methods):
userRepository.find({
order: {
id: "ASC"
}
})
Now supports nested order by-s:
userRepository.find({
order: {
photos: {
album: {
name: "ASC"
},
},
}
})
- new
where
type signature inFindOptions
(used infind*
methods) now allows to build nested statements with conditional relations, for example:
userRepository.find({
where: {
photos: {
album: {
name: "profile"
}
}
}
})
Gives you users who have photos in their "profile" album.
FindOperator
-s can be applied for relations inwhere
statement, for example:
userRepository.find({
where: {
photos: MoreThan(10),
}
})
Gives you users with more than 10 photos.
boolean
can be applied for relations inwhere
statement, for example:
userRepository.find({
where: {
photos: true
}
})
BREAKING CHANGES
minimal Node.JS version requirement now is
14+
drop
ormconfig
support.ormconfig
still works if you use deprecated methods, however we do not recommend using it anymore, because it's support will be completely dropped in0.4.0
. If you want to have your connection options defined in a separate file, you can still do it like this:
import ormconfig from "./ormconfig.json"
const MyDataSource = new DataSource(require("./ormconfig.json"))
Or even more type-safe approach with resolveJsonModule
in tsconfig.json
enabled:
import ormconfig from "./ormconfig.json"
const MyDataSource = new DataSource(ormconfig)
But we do not recommend use this practice, because from 0.4.0
you'll only be able to specify entities / subscribers / migrations using direct references to entity classes / schemas (see "deprecations" section).
We won't be supporting all ormconfig
extensions (e.g. json
, js
, ts
, yaml
, xml
, env
).
support for previously deprecated
migrations:*
commands was removed. Usemigration:*
commands instead.all commands were re-worked. Please refer to new CLI documentation.
cli
option fromBaseConnectionOptions
(nowBaseDataSourceOptions
options) was removed (since CLI commands were re-worked).now migrations are running before schema synchronization if you have both pending migrations and schema synchronization pending (it works if you have both
migrationsRun
andsynchronize
enabled in connection options).aurora-data-api
driver now is calledaurora-mysql
aurora-data-api-pg
driver now is calledaurora-postgres
EntityManager.connection
is nowEntityManager.dataSource
Repository
now has a constructor (breaks classes extending Repository with custom constructor)@TransactionRepository
,@TransactionManager
,@Transaction
decorators were completely removed. These decorators do the things out of the TypeORM scope.Only junction table names shortened.
MOTIVATION: We must shorten only table names generated by TypeORM.
It's user responsibility to name tables short if their RDBMS limit table name length
since it won't make sense to have table names as random hashes.
It's really better if user specify custom table name into @Entity
decorator.
Also, for junction table it's possible to set a custom name using @JoinTable
decorator.
findOne()
signature without parameters was dropped. If you need a single row from the db you can use a following syntax:
const [user] = await userRepository.find()
This change was made to prevent user confusion. See this issue for details.
findOne(id)
signature was dropped. Use following syntax instead:
const user = await userRepository.findOneBy({
id: id // where id is your column name
})
This change was made to provide a more type-safe approach for data querying. Due to this change you might need to refactor the way you load entities using MongoDB driver.
findOne
,findOneOrFail
,find
,count
,findAndCount
methods now only acceptFindOptions
as parameter, e.g.:
const users = await userRepository.find({
where: { /* conditions */ },
relations: { /* relations */ }
})
To supply where
conditions directly without FindOptions
new methods were added:
findOneBy
, findOneByOrFail
, findBy
, countBy
, findAndCountBy
. Example:
const users = await userRepository.findBy({
name: "Michael"
})
This change was required to simply current find*
and count*
methods typings,
improve type safety and prevent user confusion.
findByIds
was deprecated, usefindBy
method instead in conjunction withIn
operator, for example:
userRepository.findBy({
id: In([1, 2, 3])
})
This change was made to provide a more type-safe approach for data querying.
findOne
andQueryBuilder.getOne()
now returnnull
instead ofundefined
in the case if it didn't find anything in the database. Logically it makes more sense to returnnull
.findOne
now limits returning rows to 1 at database level.
NOTE: FOR UPDATE
locking does not work with findOne
in Oracle since FOR UPDATE
cannot be used with FETCH NEXT
in a single query.
where
inFindOptions
(e.g.find({ where: { ... })
) is more sensitive to input criteria now.FindConditions
(where
inFindOptions
) was renamed toFindOptionsWhere
.null
as value inwhere
used infind*
methods is not supported anymore. Now you must explicitly useIsNull()
operator.
Before:
userRepository.find({
where: {
photo: null
}
})
After:
userRepository.find({
where: {
photo: IsNull()
}
})
This change was made to make it more transparent on how to add "IS NULL" statement to final SQL, because before it bring too much confusion for ORM users.
- if you had entity properties of a non-primitive type (except Buffer) defined as columns,
then you won't be able to use it in
find*
'swhere
. Example:
Before for the @Column(/*...*/) membership: MembershipKind
you could have a query like:
userRepository.find({
membership: new MembershipKind("premium")
})
now, you need to wrap this value into Equal
operator:
userRepository.find({
membership: Equal(new MembershipKind("premium"))
})
This change is due to type-safety improvement new where
signature brings.
order
inFindOptions
(used infind*
methods) doesn't support ordering by relations anymore. Define relation columns, and order by them instead.where
inFindOptions
(used infind*
methods) previously supportedObjectLiteral
andstring
types. Now both signatures were removed. ObjectLiteral was removed because it seriously breaks the type safety, andstring
doesn't make sense in the context ofFindOptions
. UseQueryBuilder
instead.MongoRepository
andMongoEntityManager
now use new types calledMongoFindManyOptions
andMongoFindOneOptions
for theirfind*
methods.primary relation
(e.g.@ManyToOne(() => User, { primary: true }) user: User
) support is removed. You still have an ability to use foreign keys as your primary keys, however now you must explicitly define a column marked as primary.
Example, before:
@ManyToOne(() => User, { primary: true })
user: User
Now:
@PrimaryColumn()
userId: number
@ManyToOne(() => User)
user: User
Primary column name must match the relation name + join column name on related entity. If related entity has multiple primary keys, and you want to point to multiple primary keys, you can define multiple primary columns the same way:
@PrimaryColumn()
userFirstName: string
@PrimaryColumn()
userLastName: string
@ManyToOne(() => User)
user: User
This change was required to simplify ORM internals and introduce new features.
prefix relation id columns contained in embedded entities (#7432)
find by Date object in sqlite driver (#7538)
issue with non-reliable
new Date(ISOString)
parsing (#7796)
DEPRECATIONS
all CLI commands do not support
ormconfig
anymore. You must specify a file with data source instance instead.entities
,migrations
,subscribers
options insideDataSourceOptions
acceptingstring
directories support is deprecated. You'll be only able to pass entity references in the future versions.all container-related features (
UseContainerOptions
,ContainedType
,ContainerInterface
,defaultContainer
,useContainer
,getFromContainer
) are deprecated.EntityManager's
getCustomRepository
used within transactions is deprecated. UsewithRepository
method instead.Connection.isConnected
is deprecated. Use.isInitialized
instead.select
inFindOptions
(used infind*
methods) used as an array of property names is deprecated. Now you should use a new object-literal notation. Example:
Deprecated way of loading entity relations:
userRepository.find({
select: ["id", "firstName", "lastName"]
})
New way of loading entity relations:
userRepository.find({
select: {
id: true,
firstName: true,
lastName: true,
}
})
This change is due to type-safety improvement new select
signature brings.
relations
inFindOptions
(used infind*
methods) used as an array of relation names is deprecated. Now you should use a new object-literal notation. Example:
Deprecated way of loading entity relations:
userRepository.find({
relations: ["contacts", "photos", "photos.album"]
})
New way of loading entity relations:
userRepository.find({
relations: {
contacts: true,
photos: {
album: true
}
}
})
This change is due to type-safety improvement new relations
signature brings.
join
inFindOptions
(used infind*
methods) is deprecated. UseQueryBuilder
to build queries containing manual joins.Connection
,ConnectionOptions
are deprecated, new names to use are:DataSource
andDataSourceOptions
. To create the same connection you had before use a new syntax:new DataSource({ /*...*/ })
.createConnection()
,createConnections()
are deprecated, sinceConnection
is calledDataSource
now, to create a connection and connect to the database simply do:
const myDataSource = new DataSource({ /*...*/ })
await myDataSource.connect()
getConnection()
is deprecated. To have a globally accessible connection, simply export your data source and use it in places you need it:
export const myDataSource = new DataSource({ /*...*/ })
// now you can use myDataSource anywhere in your application
getManager()
,getMongoManager()
,getSqljsManager()
,getRepository()
,getTreeRepository()
,getMongoRepository()
,createQueryBuilder()
are all deprecated now. Use globally accessible data source instead:
export const myDataSource = new DataSource({ /*...*/ })
export const Manager = myDataSource.manager
export const UserRepository = myDataSource.getRepository(UserEntity)
export const PhotoRepository = myDataSource.getRepository(PhotoEntity)
// ...
getConnectionManager()
andConnectionManager
itself are deprecated - nowConnection
is calledDataSource
, and each data source can be defined in exported variable. If you want to have a collection of data sources, just define them in a variable, simply as:
const dataSource1 = new DataSource({ /*...*/ })
const dataSource2 = new DataSource({ /*...*/ })
const dataSource3 = new DataSource({ /*...*/ })
export const MyDataSources = {
dataSource1,
dataSource2,
dataSource3,
}
getConnectionOptions()
is deprecated - in next version we are going to implement different mechanism of connection options loadingAbstractRepository
is deprecated. Use new way of custom repositories creation.Connection.name
andBaseConnectionOptions.name
are deprecated. Connections don't need names anymore since we are going to drop all related methods relying on this property.all deprecated signatures will be removed in
0.4.0
EXPERIMENTAL FEATURES NOT PORTED FROM NEXT BRANCH
observers
- we will consider returning them back with new API in future versionsalternative find operators
- using$any
,$in
,$like
and other operators inwhere
condition.
0.2.45 (2022-03-04)
Bug Fixes
- allow clearing database inside a transaction (#8712) (f3cfdd2), closes #8527
- discard duplicated columns on update (#8724) (0fc093d), closes #8723
- fix entityManager.getId for custom join table (#8676) (33b2bd7), closes #7736
- force web bundlers to ignore index.mjs and use the browser ESM version directly (#8710) (411fa54), closes #8709
Features
- add nested transaction (#8541) (6523526), closes #1505
- add transformer to ViewColumnOptions (#8717) (96ac8f7)
0.2.44 (2022-02-23)
Bug Fixes
- alter relation loader to use transforms when present (#8691) (2c2fb29), closes #8690
- cannot read properties of undefined (reading 'joinEagerRelations') (136015b)
- expo driver doesn't work properly because of new beforeMigration() afterMigration() callbacks (#8683) (5a71803)
- ng webpack default import (#8688) (2d3374b), closes #8674
- support imports of absolute paths of ESM files on Windows (#8669) (12cbfcd), closes #8651
Features
- add option to upsert to skip update if the row already exists and no values would be changed (#8679) (8744395)
- allow
{delete,insert}().returning()
on MariaDB (#8673) (7facbab), closes #7235 #7235 - Implement deferrable foreign keys for SAP HANA (#6104) (1f54c70)
0.2.43 (2022-02-17)
Bug Fixes
- support
require
to internal files without explicitly writing.js
in the path (#8660) (96aed8a), closes #8656
Features
Reverts
0.2.42 (2022-02-16)
Bug Fixes
- proper column comment mapping from database to metadata in aurora-data-api (baa5880)
- add referencedSchema to PostgresQueryRunner (#8566) (c490319)
- adding/removing @Generated() will now generate a migration to add/remove the DEFAULT value (#8274) (4208393), closes #5898
- adds entity-schema support for createForeignKeyConstraints (#8606) (f224f24), closes #8489
- allow special keyword as column name for simple-enum type on sqlite (#8645) (93bf96e)
- correctly handle multiple-row insert for SAP HANA driver (#7957) (8f2ae71)
- disable SQLite FK checks in synchronize / migrations (#7922) (f24822e)
- find descendants of a non-existing tree parent (#8557) (cbb61eb), closes #8556
- For MS SQL Server use lowercase "sys"."columns" reference. (#8400) (#8401) (e8a0f92)
- improve DeepPartial type (#8187) (b93416d)
- Lock peer dependencies versions (#8597) (600bd4e)
- make EntityMetadataValidator comply with entitySkipConstructor, cover with test (#8445) (3d6c5da), closes #8444
- materialized path being computed as "undefined1." (#8526) (09f54e0)
- MongoConnectionOptions sslCA type mismatch (#8628) (02400da)
- mongodb repository.find filters soft deleted rows (#8581) (f7c1f7d), closes #7113
- mongodb@4 compatibility support (#8412) (531013b)
- must invoke key pragma before any other interaction if SEE setted (#8478) (546b3ed), closes #8475
- nested eager relations in a lazy-loaded entity are not loaded (#8564) (1cfd7b9)
- QueryFailedError when tree entity with JoinColumn (#8443) (#8447) (a11c50d)
- relation id and afterAll hook performance fixes (#8169) (31f0b55)
- replaced custom uuid generator with
uuid
library (#8642) (8898a71) - single table inheritance returns the same discriminator value error for unrelated tables where their parents extend from the same entity (#8525) (6523fcc), closes #8522
- updating with only
update: false
columns shouldn't trigger @UpdateDateColumn column updation (2834729), closes #8394 #8394 #8394 - upsert should find unique index created by one-to-one relation (#8618) (c8c00ba)
Features
- add comment param to FindOptions (#8545) (ece0da0)
- add custom timestamp option in migration creation (#8501) (4a7f242), closes #8500 #8500
- add support for node-redis v4.0.0 and newer (#8425) (0626ed1)
- add support for Postgres 10+ GENERATED ALWAYS AS IDENTITY (#8371) (a0f09de), closes #8370
- add WITH (lock) clause for MSSQL select with join queries (#8507) (3284808), closes #4764
- adds entity-schema support for withoutRowid (#8432) (bd22dc3), closes #8429
- allow soft-deletion of orphaned relation rows using orphanedRow… (#8414) (cefddd9)
- custom name for typeorm_metadata table (#8528) (f8154eb), closes #7266
- deferrable option for Unique constraints (Postgres) (#8356) (e52b26c)
- ESM support (#8536) (3a694dd), closes #6974 #6941 #7516 #7159
- query builder negating with "NotBrackets" for complex expressions (#8476) (fe7f328)
- separate update events into update, soft-remove, and recover (#8403) (93383bd), closes #8398
- soft delete recursive cascade (#8436) (d0f32b3)
- sqlite attach (#8396) (9e844d9)
Reverts
BREAKING CHANGES
- update listeners and subscriber no longer triggered by soft-remove and recover
0.2.41 (2021-11-18)
Bug Fixes
- add
retryWrites
toMongoConnectionOptions
(#8354) (c895680), closes #7869 - create typeorm_metadata table when running migrations (#4956) (b2c8168)
- db caching won't work with replication enabled (#7694) (2d0abe7), closes #5919
- incorrect composite
UNIQUE
constraints detection (#8364) (29cb891), closes #8158 - Postgres enum generates unnecessary queries on schema sync (#8268) (98d5f39)
- resolve issue delete column null on after update event subscriber (#8318) (8a5e671), closes #6327
Features
- export interfaces from schema-builder/options (#8383) (7b8a1e3)
- implement generated columns for postgres 12 driver (#6469) (91080be)
- lock modes in cockroachdb (#8250) (d494fcc), closes #8249
0.2.40 (2021-11-11)
Bug Fixes
Features
- add depth limiter optional parameter when loading nested trees using TreeRepository's findTrees() and findDescendantsTree() (#7926) (0c44629), closes #3909
- add upsert methods for the drivers that support onUpdate (#8104) (3f98197), closes #2363
- Postgres IDENTITY Column support (#7741) (969af95)
Reverts
- "feat: use char(36) for uuid representation in mysql (#7853)" (#8343) (1588c58)
- regression in ordering by the relation property (#8346) (#8352) (0334d10), closes #3736 #8118
0.2.39 (2021-11-09)
Bug Fixes
- attach FOR NO KEY UPDATE lock to query if required (#8008) (9692930), closes #7717
- cli should accept absolute paths for --config (4ad3a61)
- create a different cacheId if present for count query in getManyAndCount (#8283) (9f14e48), closes #4277
- defaults type cast filtering in Cockroachdb (#8144) (28c183e), closes #7110 #7110
- do not generate migration for unchanged enum column (#8161) (#8164) (4638dea)
- NativescriptQueryRunner's query method fails when targeting es2017 (#8182) (8615733)
- OneToManySubjectBuilder bug with multiple primary keys (#8221) (6558295)
- ordering by joined columns for PostgreSQL (#3736) (#8118) (1649882)
- support DeleteResult in SQLiteDriver (#8237) (b678807)
Features
- add
typeorm
command wrapper to package.json in project template (#8081) (19d4a91) - add dependency configuraiton for views #8240 (#8261) (2c861af)
- add relation options to all tree queries (#8080) (e4d4636), closes #8076
- add the ability to pass the driver into all database types (#8259) (2133ffe)
- more informative logging in case of migration failure (#8307) (dc6f1c9)
- support using custom index with SelectQueryBuilder in MySQL (#7755) (f79ae58)
Reverts
0.2.38 (2021-10-02)
Bug Fixes
- prevent using absolute table path in migrations unless required (#8038) (e9366b3)
- snakecase conversion for strings with numbers (#8111) (749511d)
- use full path for table lookups (#8097) (22676a0)
Features
0.2.37 (2021-08-13)
Bug Fixes
- allow periods in parameter identifiers (#8022) (4201938)
- ConnectionManager
connections
property should include list ofConnection
s (#8004) (2344db6) - entity value for date columns that are related (#8027) (5a3767f)
- handle brackets when only one condition is passed (#8048) (ab39066)
- handle enums with multiple apostrophes in MySQL (#8013) (37c40a6), closes #8011
- include all drivers in driverfactory error message (#8061) (fbd1ef7)
- resolve not returning soft deleted relations with withDeleted find option (#8017) (65cbcc7)
- SAP HANA inserts used incorrect value for returning query (#8072) (36398db)
- some drivers set the wrong database name when defined from url (#8058) (a3a3284)
- throw error when not connected in drivers (#7995) (cd71f62)
Features
- add relations option to tree queries (#7981) (ca26297), closes #7974 #4564
- add serviceName option for oracle connections (#8021) (37bd012)
- add support to string array on dropColumns (#7654) (91d5b2f)
- support Oracle Implicit Results (#8050) (fe78bee)
0.2.36 (2021-07-31)
Bug Fixes
- add deprecated
WhereExpression
alias forWhereExpressionBuilder
(#7980) (76e7ed9) - always generate migrations with template string literals (#7971) (e9c2af6)
- use js rather than ts in all
browser
package manifests (#7982) (0d90bcd) - use nvarchar/ntext during transit for SQLServer queries (#7933) (62d7976)
Features
0.2.35 (2021-07-28)
Bug Fixes
entity
to bePartial<Entity>
|undefined
inUpdateEvent
(#7783) (f033045)- actually return a working ReadStream from SQL Server query runner (#7893) (e80985f)
- added version check before dropping materialized views to keep backward compatibility (#7716) (29f1f86)
- allow for string id in mongo.findByIds call (#7838) (4b45ae1)
- better support of relation-based properties in where clauses (#7805) (3221c50)
- Buffer in primary columns causes bugs with relations (#7952) (37e08a7), closes #4060
- capacitor does not correctly set journal mode (#7873) (5f20eb7)
- Capacitor driver PRAGMA requests failing on Android (#7728) (9620a26)
- condition is optional in SelectQueryBuilder joins (#7888) (2deaa0e)
- correctly handle mongo replica set driver option (#7908) (9212df4)
- correctly load yml in ConnectionOptionsYmlReader (#7743) (57f9254)
- craft oracle connectString as a descriptor with SID (#7878) (b05d093)
- delete operation in MongoDB impact all matched documents (#7811) (0fbae53), closes #7809
- Do not add NULL/NOT NULL for stored columns (#7708) (3c33e9f), closes #7698
- do OBJECT_ID lookup for column constraint instead of name in mssql (#7916) (fa8c1b0)
- drop pool.autostart from mssql options because it's unused (#7877) (0d21a4d)
- drop SAP statement after
prepare
per Hana client docs (#7748) (8ca05b1) - eager relation respects children relations (#5685) (e7e887a)
- enable returning additional columns with MSSQL (#7864) (e1db48d)
- entity object undefined in
afterUpdate
subscriber (#7724) (d25304d) - find operation in MongoDB do not include nullable values from documents (#7820) (98c13cf), closes #7760
- fix table loading when schemas are used (3a106a3)
- foreign keys in SAP were loading from the wrong table (#7914) (4777a79)
- handle postgres default when tableColumn.default is not string (#7816) (0463855)
- handle snake case of ABcD which should become a_bc_d (#7883) (eb680f9)
- improve query for MSSQL to fetch foreign keys and tables (#7935) (f6af01a)
- make
OracleQueryRunner
createDatabase if-not-exists not fail (f5a80ef) - only pass
data
from SaveOptions during that query (#7886) (1de2e13) - oracle cannot support DB in table identifiers (#7954) (8c60d91)
- pass table to namingstrategy when we can instead of table name (#7925) (140002d)
- prevent modification of the FindOptions.relations (#7887) (a2fcad6)
- prevent reuse of broken connections in postgres pool (#7792) (5cf368a)
- prevent transactions in the Cordova driver (#7771) (fc4133c)
- properly escape oracle table paths (#7917) (7e8687c)
- regression when making
join
conditionsundefined
-able (#7892) (b0c1cc6) - restored
buildColumnAlias
for backward compatibility (#7706) (36ceefa) - return correct DeleteResult and UpdateResult for mongo (#7884) (7a646a2)
- support fully qualified schema in createSchema (#7934) (94edd12)
- support table names between schemas in oracle (#7951) (aa45b93)
- typing so SelectQueryBuilder.getRawOne may return undefined (#7863) (36e5a0c), closes #7449
- typo prevented us from pulling the schema correctly in some cases (c7f2db8)
- update operation in MongoDB impact all matched documents (#7803) (052014c), closes #7788
- use correct query for cross-database mssql identity check (#7911) (7869fb1)
- use fully qualified and escaped table names for oracle (#7857) (2b90725), closes #7779
- use ObjectLiteral in UpdateEvent rather than
Entity
(#7910) (78fbc14) - use only table name in constraint naming strategy (5dc777f)
Features
- add
retryWrites
to allowed mongoextra
options (#7869) (dcdaaca) - add capacitor driver options for encryption & version (#7868) (a2bd94b)
- add connection option
entitySkipConstructor
(f43d561) - add ObjectLiteral typing to andWhere / orWhere (#7786) (525381d)
- add parseTableName to Driver interface (#7956) (cffbf43)
- add path, database, and schema to Table (#7913) (444e38b)
- add property for database and schema in views (#7953) (4c5bbd9)
- add referenced database & schema to TableForeignKey (fff6b11)
- add writeConcern option as a possible
extras
for mongodb (#7801) (90894c7) - consistent parsing and escaping of table names in QueryRunners (bd9e767)
- implement OracleQueryRunner.hasDatabase (128b982)
- make parameter to getTables optional (#7901) (ba86602)
- make postgres extensions install optional (#7725) (92b96a5), closes #7662
- publicly export
Transaction*Event
types (#7949) (2436a66), closes /github.com/typeorm/typeorm/blob/master/src/subscriber/EntitySubscriberInterface.ts#L12 - set
enableArithAbort
for SQLServerDriver (#7894) (1f64da2) - support absolute path in migration:generate (#7720) (b690c27)
- use char(36) for uuid representation in mysql (#7853) (063aafa)
- use column length from driver when creating columns (#7858) (b107ad9)
0.2.34 (2021-06-03)
Bug Fixes
0.2.33 (2021-06-01)
Bug Fixes
- @Unique constraint is not created with specified name (beea2e1)
MATERIALIZED VIEW
is treated as a regularVIEW
which causes issues on sync (#7592) (f85f436)- added error handler for slave connections in MySQL and AuroraDataApi drivers (#7641) (882a740)
- call listeners for array embeddeds in MongoDB (#4260) (2dc355b)
- closing pool incorrectly works on Postgres (#7596) (1310c97), closes #6958 #6958 #6958
- column name with empty spaces causes bug in Index/Unique decorators #7534 (a3a6e06)
- correctly strip type conversion in postgres for default values (#7681) (069b8b6), closes #1532 #7647 #5132
- datetime functions in column "default" leads to unnecessary queries during synchronization (#7517) (03f3285), closes #3991 #3991 #2737 #2737 #6412 #4281 #4658 #3991 #2333 #7381 #4658 #3991 #3991 #3991 #3991
- default
schema
defined in entity/connection leads to unnecessary queries during schema sync (#7575) (7eb0327), closes #7276 #7276 - do a deep comparison to see if the default value has changed for
json
types in Postgres (#7650) (a471c1b) - Incorrect migration generated when multiple views are updated in a single migration (#7587) (0b103dd), closes #7586
- issues with custom enum name in Postgres (#7661) (ad0262a), closes #7614 #7541 #7647 #6540
- mongodb connectionURL parse options (#7560) (b2ac41a)
- mongodb typings for Cursor (#7526) (daf3991)
- only first \0 is removed in comments, only first \ is escaped etc. (#7532) (36b14cb)
- pass
ManyToMany
onUpdate
option to foreign key metadata (#5714) (198d2c5), closes #4980 - Postgres identifier exceeds limit on eager relations (#7508) (#7509) (e4ec429)
- remove
enableExtension
for slave connections in Postgres (#7693) (620aac9), closes #7691 - replaced deprecated
insert
method withinsertOne
for MongoDriver in MigrationExecutor. (#7594) (83fed60) - resolve issue when enum that has functions is used in entity (#7653) (dba327d), closes #7651
- Silent failure in createDatabase and dropDatabase with Postgres (#7590) (974d2d4), closes #6867
- STI types on children in joins (#3160) (60a6c5d)
- use
host
ifhostReplicaSet
is not provided in MongoDriver (#7559) (9b6d7bc) - use migrationsTransactionMode while running migration from cli (#7576) (7953ebb)
- use most specific matching relation type (#2967) (ee3c00a)
Features
- add
orphanedRowAction
option to EntitySchemaRelationOptions (#7625) (a8eb49a), closes #7417 - add
set
datatype support for aurora-data-api (#7665) (b6c1836) - add support for specifying
ioredis
cache with a URL (#7689) (e017f9b), closes #7631 - add tree entities update and delete logic (#7156) (9c8a3fb), closes #7155
- added Capacitor driver (#7695) (0f7a778)
- cache option to ignore errors (#7630) (5fde0ea), closes #926
- define class properties for QueryFailedError to allow users to access a typed error (#7529) (b43dcba)
- support
MAX_EXECUTION_TIME
for MySQL driver. (#7638) (0564c34)
0.2.32 (2021-03-30)
Bug Fixes
- aurora-data-api get correct increment primary key for multiple entities inserted (#7434) (fc8af5f), closes #7385
- aurora-data-api return number of affected rows in UpdatedResult and DeleteResult (#7433) (46aba1d), closes #7386
- RelationLoader load with existing queryRunner (#7471) (2dcb493), closes #5338
- Array type default value should not generate SQL commands without change (#7409) (7f06e44)
- correctly get referenceColumn value in
getEntityValueMap
(#7005) (7fe723b), closes #7002 - don't transform json(b) column value when computing update changes (#6929) (6be54d4)
- empty entity when query with nested relations (#7450) (9abf727), closes #7041 #7041 #7041
- fixed all known enum issues (#7419) (724d80b), closes #5371 #6471 #7217 #6047 #7283 #5871 #5729 #5478 #5882 #5275 #2233 #5648 #4897 #6376 #6115
- improve EntityManager.save() return type (#7391) (66fbfda)
- Only first single quote in comments is escaped (#7514) (e1e9423)
- performance issues of
RelationId
. (#7318) (01a215a), closes #5691 - rename a sequence related to generated primary key when a table is renamed (#5406) (25b457f)
- resolve issue building tree entities with embeded primary column (#7416) (dc81814), closes #7415
- wrong migration generation when column default value is set to null #6950 (#7356) (5a3f9ff)
Features
- add check and dry-run to migration generate (#7275) (d6df200), closes #3037 #6978
- add option for installing package using CLI (#6889) (3d876c6)
- Add support for Access Token Authentication for SQL Server Driver (mssql) (#7477) (e639772)
- added socketPath support for replicas in MySQL driver (#7459) (8d7afaf)
- allow to pass the given table name as string in RelationDecorators (#7448) (4dbb10e)
- implement "FOR UPDATE OF" for postgres driver (#7040) (fde9f07)
- introduced a new configuration option "formatOptions.castParameters" to delegate the prepare/hydrate parameters to the driver which will result in casting the parameters to their respective column type (#7483) (7793b3f)
- output Javascript Migrations instead of TypeScript (#7294) (b97cc4f)
0.2.31 (2021-02-08)
Bug Fixes
- append condition to STI child entity join (#7339) (68bb82e)
- avoid regex lookbehind for compatibility (#7270) (063d27f), closes #7026
- cache from ENV - add ioredis support (#7332) (5e2117c)
- datetime2 rounding in mssql (#7264) (4711a71), closes #3202
- escape columns in InsertQueryBuilder.orUpdate (#6316) (ab56e07)
- incorrect postgres uuid type in PrimaryGeneratedColumnType (#7298) (2758502)
- MariaDB VIRTUAL + [NOT NULL|NULL] error (#7022) (82f2b75), closes #2691
- reject nullable primary key columns (#7001) (cdace6e)
- resolve issue with find with relations returns soft-deleted entities (#7296) (d7cb338), closes #6265
- save does not return id, save does not return generated (#7336) (01a6aee)
Features
- enable explicitly inserting IDENTITY values into mssql (#6199) (4abbd46), closes #2199
- export all errors (#7006) (56300d8)
- option to disable foreign keys creation (#7277) (cb17b95), closes #3120 #3120
- support maxdecimaldigits option by geometry type (#7166) (d749008)
- useUTC connection option for oracle and postgres (#7295) (e06a442)
BREAKING CHANGES
- passing
ColumnOptions
to@PrimaryColumn
does not function anymore. One must usePrimaryColumnOptions
instead. - minor breaking change on "conflict*" options - column names used are now automatically escaped.
0.2.30 (2021-01-12)
Bug Fixes
- add missing "comment" field to QB clone method (#7205) (f019771), closes #7203
- avoid early release of PostgresQueryRunner (#7109) (#7185) (9abe007)
- Error when sorting by an embedded entity while using join and skip/take (#7082) (d27dd2a), closes #7079
- Fix CLI query command TypeError (#7043) (b35397e)
- get length attribute of postgres array columns (#7239) (eb82f78), closes #6990
- handle overlapping property / database names in querybuilder (#7042) (b518fa1), closes #7030
- improve stack traces when using persist executor (#7218) (0dfe5b8)
- order should allow only model fields, not methods (#7188) (0194193), closes #7178
- resolve migration for UpdateDateColumn without ON UPDATE clause (#7057) (ddd8cbc), closes #6995
- resolves Postgres sequence identifier length error (#7115) (568ef35), closes #7106
- return 'null' (instead of 'undefined') on lazy relations that have no results (#7146) (#7147) (9b278c9)
- support MongoDB DNS seed list connection (#7136) (f730bb9), closes #3347 #3133
- data-api: Fixed how data api driver uses and reuses a client (#6869) (6ce65fb)
- use default import of yargs for --help (#6986) (6ef8ffe)
Features
- add NOWAIT and SKIP LOCKED lock support for MySQL (#7236) (9407507), closes #6530
- closure table custom naming (#7120) (bcd998b)
- JavaScript file migrations output (#7253) (ce9cb87)
- relations: Orphaned row action (#7105) (efc2837)
0.2.29 (2020-11-02)
Bug Fixes
- allow falsey discriminator values (#6973) (f3ba242), closes #3891
- allow for complex jsonb primary key columns (#6834) (f95e9d8), closes #6833
- Allows valid non-object JSON to be retrieved in simple-json columns (#6574) (0aedf43), closes #5501
- Cannot read property 'hasMetadata' of undefined (#5659) (0280cdc), closes #3685
- check if the connection is closed before executing a query. This prevents SQLITE_MISUSE errors (https://sqlite.org/rescode.html#misuse) originating from sqlite itself (#6975) (5f6bbec)
- check mysql constraint schema on join (#6851) (d2b914d), closes #6169 #6169
- correct reading of custom ormconfig.env files (#6922) (a09fb7f)
- explicitly define
query
command's param (#6899) (4475d80), closes #6896 - findRoots should get the defined primary key column (#6982) (f2ba901), closes #6948 #6948
- Fix Mongodb delete by ObjectId. Closes #6552 (#6553) (e37eb1e)
- fixes the typescript errors in EntityCreateCommand & SubscriberCreateCommand (#6824) (0221a93)
- handle count multiple PK & edge cases more gracefully (#6870) (4abfb34), closes #5989 #5314 #4550
- Handle undefined querysets in QueryCommand (#6910) (6f285dc), closes #6612
- handle Undefined values in driver URL options (#6925) (6fa2df5)
- ILike operator generally available for any driver (#6945) (37f0d8f)
- Only check for discriminator conflicts on STI entities (#2985) (06903d1), closes #2984
- postgresql connection URL can use an UNIX Socket (#2614) (#6042) (21c4166)
- prevent create-type commands edge-case TypeErrors (#6836) (08ec0a8), closes #6831
- redundant migration with decimal default (#6879) (6ff67f7), closes #6140 #5407
- remove @DiscriminatorValue from error message (#5256) (2bf15ca), closes #5255
- resolves issue proto-less object validation (#6884) (e08d9c6), closes #2065
- return null for nullable RelationId() column (#6848) (7147a0d), closes #6815
- subscribers should use the subscribersDir (5ef9450)
- support changing comments in MySQL columns (#6903) (c5143aa)
- support combination of many-to-one/cacade/composte PK (#6417) (9a0497b)
- support empty
IN
clause across all dialects (#6887) (9635080), closes #4865 #2195 - support multiple row insert on oracle (#6927) (a5eb946), closes #2434
- sync the typeorm-model-shim (#6891) (c72e48b), closes #6288 #5920
- TreeRepository based entities primary column supports custom name. (#6942) (7ec1b75)
- use
require
inReactNativeDriver
(#6814) (1a6383c), closes #6811 - use correct type for MongoQueryRunner.databaseConnection (#6906) (da70b40), closes #6453
- use pg ^8 in
init
command (6ed9906) - wrong FK loaded in multi-database environment (#6828) (c060f95), closes #6168
Features
- add ability for escaping for Raw() find operator (#6850) (91b85bf)
- add absolute path support to other CLI commands (#6807) (d9a76e9)
- Add SelectQueryBuilder.getOneOrFail() (#6885) (920e781), closes #6246
- backport ilike from next (#6862) (c8bf81e)
- Exit with code 1 on empty migration:generate (#6978) (8244ea1)
- schema synchronization for partitioned tables with PostgreSQL 12+ (#6780) (990442e)
- support
autoEncryption
option for MongoDB (#6865) (b22c27f) - Support column comments in Postgres and CockroachDB (#6902) (bc623a4), closes #3360
- support ESM in ormconfig js & ts (#6853) (7ebca2b), closes #5003
- support query comments in the query builder (#6892) (84c18a9), closes #3643
- transactional events in subscriber interface + "transaction" option in FindOptions (#6996) (0e4b239)
Performance Improvements
- Improve MySQL LoadTables Performance (#6886) (0f0e0b6), closes #6800
- Improve replacePropertyNames (#4760) (d86671c)
0.2.28 (2020-09-30)
Bug Fixes
- FindManyOptions order in parameter typing is important (51608ae)
- lock Typescript to 3.6.0 (#6810) (7f7e4d5), closes #6809 #6805
0.2.27 (2020-09-29)
Bug Fixes
- add dummy for FileLogger, ConnectionOptionsReaders, and update gulpfile (#6763) (180fbd4)
- backport FindOperator return types (#6717) (2b37808)
- coerce port to number in ConnectionOptionsEnvReader (#6786) (55fbb69), closes #6781
- count() method for multiple primary keys for cockroachdb (#6745) (dfe8259)
- enforce name argument of migration generate command (#2719) (#6690) (dfcb2db), closes #4798 #4805 #4798 #4805
- ensure browser builds don't include any non-browser modules (#6743) (c714867), closes #6739
- hdb-pool is not namespaced under @sap (#6700) (9583430), closes #6697
- migration:generate issue with onUpdate using mariadb 10.4 (#6714) (6e28322)
- prevent multiple
release
listeners in PostgresQueryRunner (#6708) (208cf6b), closes #6699 - prevent wrong returned entity in ReturningResultsEntityUpdator (#6440) (c1c8e88)
- resolve issues ora-00972:identifier is too long (#6751) (b55a417), closes #5067 #5067
- sql.js v1.2+ don't support undefined parameters (#6698) (ea59b8d), closes #5720
Features
- add option to pass postgres server notices to client logger (#6215) (5084e47), closes #2216
- backport SQLite Busy handler & WAL mode enable (#6588) (7a52f18)
- Beautify generated SQL for migrations (#6685) (370442c), closes #4415
- create EntityTarget and use instead of EntitySchema / ObjectType / etc (#6701) (8b68f40)
Reverts
- Revert "fix: properly override database url properties (#6247)" (#6802) (45b980c), closes #6247 #6802
0.2.26 (2020-09-10)
Bug Fixes
- @JoinTable does not respect inverseJoinColumns referenced column width (#6444) (f642a9e), closes #6442
- add missing schema for OracleDriver (#6673) (8b8bc35)
- change InsertQueryBuilder.values() with an empty array into a no-op (#6584) (9d2df28), closes #3111
- Child entities not being saved correctly with cascade actions (#6219) (16a2d80)
- correctly parse connection URI with query params (#6390) (54a3a15), closes #6389
- decorators should implement the official TypeScript interface (#6398) (c23c888), closes #5922
- DeepPartial with any and {[k: string]: any} (#6581) (8d90d40), closes #6580 #6580
- exporting missing load event (#6396) (c6336aa)
- get correct insert ids for multiple entities inserted (#6668) (ef2011d), closes #2131 #5973 #2131
- getPendingMigrations isn't properly working (#6372) (7c0da1c)
- handle 'error' events from pool connection (#6262) (ae3cf0e)
- insert IN(null) instead of IN() when In([]) empty array for mysqlDriver (#6237) (6f6bdbd)
- make only a single SELECT to get inserted default and generated values of multiple entities (#6669) (4fc4a1b), closes #6266 #6266
- Migration issues with scale & precision in sqlite/sql.js (#6638) (0397e44), closes #6636
- mysql migration: make sure the indices sql which left-join be the same database (#6426) (906d97f)
- pass
ids_
to alias builder to prevent length overflow (#6624) (cf3ad62) - pass formatOptions to Data API Client, fix extensions (#6404) (9abab82), closes #1
- Query builder makes query with joins, without limit for inherited entities (#6402) (874e573), closes #6399
- remove unnecessary optionality from Raw operator's columnAlias argument (#6321) (0d99b46)
- resolve missing decorators on shim (#6354) (8e2d97d), closes #6093
- revert fix handle URL objects as column field values (#6145) (e073e02)
- SqlQueryRunner.hasColumn was not working (#6146) (a595fed), closes #5718
- support multiple
JoinColumn
s in EntitySchema (#6397) (298a3b9), closes #5444 - Unnecessary migrations for fulltext indices (#6634) (c81b405), closes #6633
- unnecessary migrations for unsigned numeric types (#6632) (7ddaf23), closes #2943 /github.com/typeorm/typeorm/pull/6632#pullrequestreview-480932808
- update query deep partial TypeScript definition (#6085) (23110d1)
Features
- add AWS configurationOptions to aurora-postgres connector (#6106) (203f51d)
- add better-sqlite3 driver (#6224) (2241451)
- add postgres connection timeout option (#6160) (0072149)
- FileLogger accepts custom file path (#6642) (c99ba40), closes #4410
- implement postgres ltree (#6480) (43a7386), closes #4193
- support absolute paths in migrationsDir for the CLI (#6660) (2b5f139)
- support cjs extension for ormconfig (#6285) (6eeb03a)
0.2.25 (2020-05-19)
Bug Fixes
- 'in' clause case for ORACLE (#5345) (8977365)
- calling EntityManager.insert() with an empty array of entities (#5745) (f8c52f3), closes #5734 #5734 #5734
- columns with transformer should be normalized for update (#5700) (4ef6b65), closes #2703
- escape column comment in mysql driver (#6056) (5fc802d)
- expo sqlite driver disconnect() (#6027) (61d59ca)
- HANA - SSL options, column delta detection mechanism (#5938) (2fd0a8a)
- handle URL objects as column field values (#5771) (50a0641), closes #5762 #5762
- insert and update query builder to handle mssql geometry column correctly (#5947) (87cc6f4)
- migrations being generated for FK even if there are no changes (#5869) (416e419)
- multiple assignments to same column on UPDATE #2651 (#5598) (334e17e)
- prevent TypeError when calling bind function with sql.js 1.2.X (#5789) (c6cbddc)
- prototype pollution issue (#6096) (db9d0fa)
- provide a default empty array for parameters. (#5677) (9e8a8cf)
- redundant undefined parameters are not generated in migration files anymore (#5690) (d5cde49)
- replacing instanceof Array checks to Array.isArray because instanceof Array seems to be problematic on some platforms (#5606) (b99b4ad)
- respect database from connection urls (#5640) (ed75d59), closes #2096
- sha.js import (#5728) (8c3f48a)
- Unknown fields are stripped from WHERE clause (issue #3416) (#5603) (215f106)
- update dependency mkdirp to 1.x (#5748) (edeb561)
- update Entity decorator return type to ClassDecorator (#5776) (7d8a1ca)
- use an empty string enum as the type of a primary key column (#6063) (8e0d817), closes #3874
- use correct typings for the result of
getUpsertedIds()
(#5878) (2ab88c2) - wrong table name parameter when not using default schema (#5801) (327144a)
Features
- add FOR NO KEY UPDATE lock mode for postgresql (#5971) (360122f)
- add name option to view column (#5962) (3cfcc50), closes #5708
- Add soft remove and recover methods to entity (#5854) (9d2b8e0)
- added support for NOWAIT & SKIP LOCKED in Postgres (#5927) (2c90e1c)
- Aurora Data API - Postgres Support (#5651) (e584297)
- aurora Data API - Support for AWS configuration options through aurora driver (#5754) (1829f96)
- create-column, update-column, version-column column kinds now support user specified values (#5867) (5a2eb30), closes #3271
- names of extra columns for specific tree types moved to NamingStrategy (#5737) (ec3be41)
- PG allow providing a function for password (#5673) (265d1ae)
- update cli migration up and down from any to void (#5630) (76e165d)
- UpdateResult returns affected rows in mysql (#5628) (17f2fff), closes #1308
Performance Improvements
0.2.23, 0.2.24 (2020-02-28)
Bug Fixes
- .synchronize() drops json column on mariadb (#5391) (e3c78c1), closes typeorm/typeorm#3636
- (base-entity) set create return type to T[] (#5400) (ceff897)
- add the enableArithAbort option to the sql server connection option typings (#5526) (d19dbc6)
- bug when default value in mssql were not updated if previous default was already set (9fc8329)
- change OrmUtils.mergeDeep to not merge RegExp objects (#5182) (0f51836), closes #3534
- fk on update should not use attributes of on delete (2baa934)
- load typeorm-aurora-data-api-driver correctly when using webpack (#4788) (#5302) (9da0d34)
- not to make typeorm generate alter query on geometry column when that column was not changed (#5525) (ee57557)
- Oracle sql expression for date column (#5305) (40e9d3a), closes #4452 #4452
- refactoring instance of with Array.isArray() (#5539) (1e1595e)
- Return NULL when normalize default null value (#5517) (1826b75), closes #5509
- SAP HANA driver fixes (#5445) (87b161f)
- update foreign keys when table name changes (#5482) (7157cb3)
- use OUTPUT INTO on SqlServer for returning columns (#5361) (6bac3ca), closes #5160 #5160
- use sha.js instead of crypto for hash calculation (#5270) (b380a7f)
Features
- Add basic support for custom cache providers (#5309) (6c6bde7)
- add fulltext parser option (#5380) (dd73395)
0.2.22 (2019-12-23)
Bug Fixes
Features
- hash aliases to avoid conflicts (#5227) (edc8e6d)
- implement driver options for NativeScript (#5217) (3e58426)
- SAP Hana support (#5246) (ec90341)
- speed up id search in buildChildrenEntityTree (#5202) (2e628c3)
BREAKING CHANGES
- aliases for very long relation names may be replaced with hashed strings. Fix: avoid collisions by using longest possible hash. Retain more entropy by not using only 8 characters of hashed aliases.
0.2.21 (2019-12-05)
Bug Fixes
- allow expireAfterSeconds 0 in Index decorator (close #5004) (#5005) (d05467c)
- do not mutate connection options (#5078) (1047989)
- mysql driver query streaming (#5036) (aff2f56)
- remove consrc usage (postgres,cockroachdb) (#4333) (ce7cb16), closes #4332
- repo for app-root-path in lock file (#5052) (f0fd192)
- resolve MySQL unique index check when bigNumberStrings is false (#4822) (d205574), closes #2737
- resolve sorting bug for several mongo vesions with typeorm migration (#5121) (cb771a1), closes #5115
- throwing error on duplicate migration names #4701 (#4704) (3e4dc9f)
- unescaped column name in order clause of "migrations" (#5108) (c0c8566)
- upgrade app-root-path (#5023) (7f87f0c)
Features
- add distinct on() support for postgres (#4954) (1293065)
- add migrations transaction option to connection options (#5147) (fb60688), closes #4629 #4629
- asynchronous ormconfig support (#5048) (f9fdaee), closes #4149
- export Migration Execution API from main package (fixes #4880) (#4892) (8f4f908)
- support spatial types of MySQL 8+ (#4794) (231dadf), closes #3702
0.2.20 (2019-10-18)
Bug Fixes
- ensure distinct property is respected cloning query builder (#4843) (ea17094), closes #4842
- aurora: apply mysql query fixes to aurora (#4779) (ee61c51)
- allow EntitySchema to be passed to EntityRepository (#4884) (652a20e)
- better timestamp comparison (#4769) (0a13e6a)
- broken database option when using replication, changes introduced by #4753 (#4826) (df5479b)
- check for version of MariaDB before extracting COLUMN_DEFAULT (#4783) (c30b485)
- connection Reuse is broken in a Lambda environment: (#4804) (7962036)
- FindOptionUtils export (#4746) (4a62b1c), closes #4745
- loading of aurora-data-api driver (#4765) (fbb8947)
- postgres: postgres query runner to create materialized view (#4877) (d744966)
- migrations run in reverse order for mongodb (#4702) (2f27581)
- mongodb Cursor.forEach types (#4759) (fccbe3e)
- Slack invite URL (#4836) (149af26)
Features
- add name to MigrationInterface (fixes #3933 and fixes #2549) (#4873) (4a73fde)
- add new transaction mode to wrap each migration in transaction (#4629) (848fb1f)
- add option to Column to specify the complete enumName (#4824) (d967180)
- add support for cube array for PostgreSQL (#4848) (154a441)
- implements Sqlite 'WITHOUT ROWID' table modifier (#4688) (c1342ad), closes #3330
0.2.19 (2019-09-13)
Bug Fixes
- "database" option error in driver when use "url" option for connection (690e6f5)
- "hstore injection" & properly handle NULL, empty string, backslashes & quotes in hstore key/value pairs (#4720) (3abe5b9)
- add SaveOptions and RemoveOptions into ActiveRecord (#4318) (a6d7ba2)
- apostrophe in Postgres enum strings breaks query (#4631) (445c740)
- change PrimaryColumn decorator to clone passed options (#4571) (3cf470d), closes #4570
- createQueryBuilder relation remove works only if using ID (#2632) (#4734) (1d73a90)
- resolve issue with conversion string to simple-json (#4476) (d1594f5), closes #4440
- sqlite connections don't ignore the schema property (#4599) (d8f1c81)
- the excessive stack depth comparing types
FindConditions<?>
andFindConditions<?>
problem (#4470) (7a0beed) - views generating broken Migrations (#4726) (c52b3d2), closes #4123
Features
- add
set
datatype support for MySQL/MariaDB (#4538) (19e2179), closes #2779 - add materialized View support for Postgres (#4478) (dacac83), closes #4317 #3996
- add mongodb
useUnifiedTopology
config parameter (#4684) (92e4270) - add multi-dimensional cube support for PostgreSQL (#4378) (b6d6278)
- add options to input init config for sql.js (#4560) (5c311ed)
- add postgres pool error handler (#4474) (a925be9)
- add referenced table metadata to NamingStrategy to resolve foreign key name (#4274) (0094f61), closes #3847 #1355
- add support for ON CONFLICT for cockroach (#4518) (db8074a), closes #4513
- Added support for DISTINCT queries (#4109) (39a8e34)
- Aurora Data API (#4375) (c321562)
- export additional schema builder classes (#4325) (e589fda)
- log files loaded from glob patterns (#4346) (e12479e), closes #4162
- UpdateResult returns affected rows in postgresql (#4432) (7808bba), closes #1308
0.2.18
Bug fixes
- fixed loadRelationCountAndMap when entities' primary keys are strings (#3946)
- fixed QueryExpressionMap not cloning all values correctly (#4156)
- fixed transform embeddeds with no columns but with nested embeddeds (mongodb) (#4131)
- fixed the getMany() result being droped randomly bug when using the buffer as primary key. (#4220)
Features
- adds
typeorm migration:show
command (#4173) - deprecate column
readonly
option in favor ofupdate
andinsert
options (#4035) - support sql.js v1.0 (#4104)
- added support for
orUpdate
in SQLlite (#4097) - added support for
dirty_read
(NOLOCK) in SQLServer (#4133) - extend afterLoad() subscriber interface to take LoadEvent (issue #4185)
- relation decorators (e.g.
@OneToMany
) now also acceptstring
instead oftypeFunction
, which prevents circular dependency issues in the frontend/browser (issue #4190) - added support for metadata reflection in typeorm-class-transformer-shim.js (issue #4219)
- added
sqlJsConfig
to input config when initializing sql.js (issue #4559)
0.2.17 (2019-05-01)
Bug fixes
- fixed transform embeddeds with boolean values (mongodb) (#3900)
- fixed issue with schema inheritance in STI pattern (#3957)
- revert changes from #3814 (#3828)
- fix performance issue when inserting into raw tables with QueryBuilder (#3931)
- sqlite date hydration is susceptible to corruption (#3949)
- fixed mongodb uniques, support 3 ways to define uniques (#3986)
- fixed mongodb TTL index (#4044)
Features
- added deferrable options for foreign keys (postgres) (#2191)
- added View entity implementation (#1024). Read more at View entities
- added multiple value transformer support (#4007)
0.2.16 (2019-03-26)
Bug fixes
- removed unused parameters from
insert
,update
,delete
methods (#3888) - fixed: migration generator produces duplicated changes (#1960)
- fixed: unique constraint not created on embedded entity field (#3142)
- fixed: FK columns have wrong length when PrimaryGeneratedColumn('uuid') is used (#3604)
- fixed: column option unique sqlite error (#3803)
- fixed: 'uuid' in PrimaryGeneratedColumn causes Many-to-Many Relationship to Fail (#3151)
- fixed: sync enums on schema sync (#3694)
- fixed: changes in enum type is not reflected when generating migration (in definition file) (#3244)
- fixed: migration will keep create and drop indexes if index name is the same across tables (#3379)
Features
- added
lock
option inFindOptions
0.2.15 (2019-03-14)
Bug fixes
- fixed bug in
connection.dropDatabase
method (#1414) - fixed "deep relations" not loaded/mapped due to the built-in max length of Postgres (#3118)
- updated all dependencies
- fixed types issue from #3725
- removed sql-function-support (
() =>
syntax) in parameters to prevent security considerations - fix sync schema issue with postgres enum in case capital letters in entity name (#3536)
Features
- added
uuidExtension
option to Postgres connection options, which allows TypeORM to use the newerpgcrypto
extension to generate UUIDs
0.2.14 (2019-02-25)
Bug fixes
- fixed migration issue with postgres numeric enum type - change queries are not generated if enum is not modified (#3587)
- fixed mongodb entity listeners in optional embeddeds (#3450)
- fixes returning invalid delete result
- reverted lazy loading properties not enumerable feature to fix related bugs
Features
- added CockroachDB support
- added browser entry point to
package.json
(3583) - replaced backend-only drivers by dummy driver in browser builds
- added
useLocalForage
option to Sql.js connection options, which enables asynchronous load and save operations of the datatbase from the indexedDB (#3554) - added simple-enum column type (#1414)
0.2.13 (2019-02-10)
Bug Fixes
- fixed undefined object id field in case property name is
_id
(3517) - allow to use mongodb index options in
Index
decorator (#3592) - fixed entity embeddeds indices in mongodb (#3585)
- fixed json/jsonb column data types comparison (#3496)
- fixed increment/decrement value of embedded entity (#3182)
- fixed missing call
transformer.from()
in case column is NULL (#3395) - fixed signatures of
update
/insert
methods, somefind*
methods in repositories, entity managers, BaseEntity and QueryBuilders - handle embedded documents through multiple levels in mongodb (#3551)
- fixed hanging connections in
mssql
driver (#3327)
Features
- Injection 2nd parameter(options) of constructor to
ioredis/cluster
is now possible(#3538)
0.2.12 (2019-01-20)
Bug Fixes
- fixed mongodb entity listeners and subscribers (#1527)
- fixed connection options builder - paramters parsed from url are assigned on top of options (#3442)
- fixed issue with logical operator precedence in
QueryBuilder
whereInIds
(#2103) - fixed missing
isolationLevel
inConnection.transaction()
method (#3363) - fixed broken findOne method with custom join column name
- fixed issue with uuid in mysql (#3374)
- fixed missing export of
Exclusion
decorator - fixed ignored extra options in mongodb driver (#3403, #1741)
- fixed signature of root
getRepository
function to acceptEntitySchema<Entity>
(#3402) - fixed false undefined connection options passed into mongodb client (#3366)
- fixed ER_DUP_FIELDNAME with simple find (#3350)
Features
- added
tslib
to reduce package size (#3457, #3458) - queries are simplified in
findByIds
andwhereInIds
for simple entities with single primary key (#3431) - added
ioredis
andioredis-cluster
cache support (#3289,#3364) - added
LessThanOrEqual
andMoreThanOrEqual
find options (#3373) - improve support of string, numeric and heterogeneous enums in postgres and mysql (#3414)
- default value of enum array in postgres is now possible define as typescript array (#3414)
@Column({
type: "enum",
enum: StringEnum,
array: true,
default: [StringEnum.ADMIN]
})
stringEnums: StringEnum[];
Breaking changes
UpdateQueryBuilder
now throw error if update values are not provided or unknown property is passed into.set()
method (#2849,#3324)
0.2.11
- hot fix for mysql schema sync bug
0.2.10
- allowed caching options from environment variable (#3321)
- more accurate type for postgres ssl parameters
- added support for
ON UPDATE CASCADE
relations for mysql repository.save
returns union type- added reuse of lazy relationships
- added ability to disable prefixes for embedded columns
- migrations can be tested
- migration run returns array of successful migrations
- added debug ENV option
- added support for postgres exclusion constraints
- bug fixes
- documentation updates
- fixed issue with mysql primary generated uuid ER_TOO_LONG_KEY (#1139)
0.2.9
UpdateEvent
now returns with containsupdatedColumns
andupdatedRelations
0.2.8
- added support for specifying isolation levels in transactions
- added SQLCipher connection option for sqlite
- added driver to support Expo platform for sqlite
- added support for nativescript
- bug fixes
- documentation updates
0.2.7
- added support for rowversion type for mssql (#2198)
0.2.6
- fixed wrong aggregate and count methods signature in mongodb
0.2.5
- added support for enum arrays in postgres
- fixed issue with lazy relations (#1953)
- fixed issue with migration file generator using a wrong class name (#2070)
- fixed issue with unhandled promise rejection warning on postgres connection (#2067)
0.2.4
- fixed bug with relation id loader queries not working with self-referencing relations
- fixed issues with zerofill and unsigned options not available in column options (#2049)
- fixed issue with lazy relation loader (#2029)
- fixed issue with closure table not properly escaped when using custom schema (#2043)
- fixed issue #2053
0.2.3
- fixed bug with selecting default values after persistence when initialized properties defined
- fixed bug with find operators used on relational columns (#2031)
- fixed bug with DEFAULT as functions in mssql (#1991)
0.2.2
- fixing bugs with STI
- fixed bug in mysql schema synchronization
0.2.1
- fixed bug with STI
- fixed bug with lazy relations inside transactions
0.2.0
- 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. 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 queryUpdateQueryBuilder
now returnsUpdateResult
which contains extended information and metadata about runned queryDeleteQueryBuilder
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 nowskipSync
in entity options has been renamed tosynchronize
. Now if it set to false schema synchronization for the entity will be disabled. 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
- 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
0.1.19
- fixed bug in InsertQueryBuilder
0.1.18
- fixed timestamp issues
0.1.17
- fixed issue with entity order by applied to update query builder
0.1.16
- security and bug fixes
0.1.15
- security and bug fixes
0.1.14
- optimized hydration performance (#1672)
0.1.13
- added simple-json column type (#1448)
- fixed transform behaviour for timestamp columns (#1140)
- fixed issue with multi-level relations loading (#1504)
0.1.12
- EntitySubscriber now fires events on subclass entity (#1369)
- fixed error with entity schema validator being async (#1448)
0.1.11
- postgres extensions now gracefully handled when user does not have rights to use them (#1407)
0.1.10
sqljs
driver now enforces FK integrity by default (same behavior assqlite
)- fixed issue that broke browser support in 0.1.8 because of the debug package (#1344)
0.1.9
- fixed bug with sqlite and mysql schema synchronization when uuid column is used (#1332)
0.1.8
- New DebugLogger (#1302)
- fixed issue with primary relations being nullable by default - now they are not nullable always
- fixed issue with multiple databases support when tables with same name are used across multiple databases
0.1.7
- fixed bug with migrations execution in mssql (#1254)
- added support for more complex ordering in paginated results (#1259)
- MSSQL users are required to add "order by" for skip/offset operations since mssql does not support OFFSET/LIMIT statement without order by applied
- fixed issue when relation query builder methods execute operations with empty arrays (#1241)
- Webpack can now be used for node projects and not only for browser projects. To use TypeORM in Ionic with minimal changes checkout the ionic-example for the needed changes. To use webpack for non-Ionic browser webpack projects, the needed configuration can be found in the docs (#1280)
- added support for loading sub-relations in via find options (#1270)
0.1.6
- added support for indices and listeners in embeddeds
- added support for
ON CONFLICT
keyword - fixed bug with query builder where lazy relations are loaded multiple times when using
leftJoinAndSelect
(#996) - fixed bug in all sqlite based drivers that generated wrong uuid columns (#1128 and #1161)
0.1.5
- fixed bug where
findByIds
would return values with an empty array (#1118) - fixed bug in MigrationExecutor that didn't release created query builder (#1201)
0.1.4
- fixed bug in mysql driver that generated wrong query when using skip (#1099)
- added option to create query builder from repository without alias(#1084)
- fixed bug that made column option "select" unusable (#1110)
- fixed bug that generated mongodb projects what don't work (#1119)
0.1.3
- added support for
sql.js
. To use it you just need to installnpm i sql.js
and usesqljs
as driver type (#894). - added explicit require() statements for drivers (#1143)
- fixed bug where wrong query is generated with multiple primary keys (#1146)
- fixed bug for oracle driver where connect method was wrong (#1177)
0.1.2
- sqlite now supports relative database file paths (#798 and #799)
- fixed bug with not properly working
update
method (#1037, #1042) - fixed bug with replication support (#1035)
- fixed bug with wrong embedded column names being generated (#969)
- added support for caching in respositories (#1057)
- added support for the
citext
column type for postgres (#1075)
0.1.1
- added support for
pg-native
for postgres (#975). To use it you just need to installnpm i pg-native
and it will be picked up automatically. - now Find Options support
-1
and1
forDESC
andASC
values. This is better user experience for MongoDB users. - now inheritances in embeddeds are supported (#966).
isArray: boolean
inColumnOptions
is deprecated. Usearray: boolean
instead.- deprecated
removeById
method, now usedeleteById
method instead. - added
insert
anddelete
methods into repository and entity manager. - fixed multiple issues with
update
,updateById
andremoveById
methods in repository and entity manager. Now they do not usesave
andremove
methods anymore - instead they are using QueryBuilder to build and execute their queries. - now
save
method can accept partial entities. - removed opencollective dependency.
- fixed issues with bulk entity insertions.
- find* methods now can find by embed conditions.
- fixed issues with multiple schema support, added option to
@JoinTable
to support schema and database. - multiple small bugfixes.
0.1.0
BREAKING CHANGES
Table
,AbstractTable
,ClassTableChild
,ClosureTable
,EmbeddableTable
,SingleTableChild
deprecated decorators were removed. UseEntity
,ClassEntityChild
,ClosureEntity
,SingleEntityChild
decorators instead.EntityManager#create
,Repository#create
,EntityManager#preload
,Repository#preload
,EntityManager#merge
,Repository#merge
methods now acceptDeepPartial<Entity>
instead ofObject
.EntityManager#merge
,Repository#merge
methods first argument is now an entity where to need to merge all given entity-like objects.- changed
find*
repository methods. Now conditions arePartial<Entity>
type. - removed
FindOptions
interface and introduced two new interfaces:FindOneOptions
andFindManyOptions
- each for its ownfindOne*
orfind*
methods. - dropped out some of options of
FindOptions
. UseQueryBuilder
instead. However, added few new options as well. - deprecated method
addParameters
has been removed fromQueryBuilder
. UsesetParameters
instead. - removed
setMaxResults
,setFirstResult
methods inQueryBuilder
. Usetake
andskip
methods instead. - renamed
entityManager
tomanager
inConnection
,AbstractRepository
and event objects.entityManager
property was removed. - renamed
persist
tosave
inEntityManager
andRepository
objects.persist
method was removed. SpecificRepository
is removed. Use relational query builder functionality instead.transaction
method has been removed fromRepository
. UseEntityManager#transaction
method instead.- custom repositories do not support container anymore.
- controller / subscriber / migrations from options tsconfig now appended with a project root directory
- removed naming strategy decorator, naming strategy by name functionality. Now naming strategy should be registered by passing naming strategy instance directly.
driver
section in connection options now deprecated. All settings should go directly to connection options root.- removed
fromTable
from theQueryBuilder
. Now use regularfrom
to select from tables. - removed
usePool
option from the connection options. Pooling now is always enabled. - connection options interface has changed and now each platform has its own set of connection options.
storage
in sqlite options has been renamed todatabase
.- env variable names for connection were changed (
TYPEORM_DRIVER_TYPE
has been renamed toTYPEORM_CONNECTION
, some other renaming). More env variable names you can find inConnectionOptionsEnvReader
class. - some api changes in
ConnectionManager
andcreateConnection
/createConnections
methods of typeorm main entrypoint. simple_array
column type now is calledsimple-array
- some column types were removed. Now orm uses column types of underlying database.
- now
number
type in column definitions (like@Column() likes: number
) maps tointeger
instead ofdouble
. This is more programmatic design. If you need to store float-pointing values - define a type explicitly. fixedLength
in column options has been removed. Now actual column types can be used, e.g.@Column("char")
or@Column("varchar")
.timezone
option has been removed from column options. Now corresponding database types can be used instead.localTimezone
has been removed from the column options.skipSchemaSync
in entity options has been renamed toskipSync
.setLimit
andsetOffset
inQueryBuilder
were renamed intolimit
andoffset
.nativeInterface
has been removed from a driver interface and implementations.- now typeorm works with the latest version of mssql (version 4).
- fixed how orm creates default values for SqlServer - now it creates constraints for it as well.
- migrations interface has changed - now
up
anddown
accept onlyQueryRunner
. To useConnection
andEntityManager
use properties ofQueryRunner
, e.g.queryRunner.connection
andqueryRunner.manager
. - now
update
method inQueryBuilder
acceptsPartial<Entity>
and property names used in update map are column property names and they are automatically mapped to column names. SpecificRepository
has been removed. Instead newRelationQueryBuilder
was introduced.getEntitiesAndRawResults
ofQueryBuilder
has been renamed togetRawAndEntities
.- in mssql all constraints are now generated using table name in their names - this is fixes issues with duplicate constraint names.
- now when object is loaded from the database all its columns with null values will be set into entity properties as null. Also after saving entity with unset properties that will be stored as nulls - their (properties) values will be set to null.
- create and update dates in entities now use date with fractional seconds.
@PrimaryGeneratedColumn
decorator now accept generation strategy as first argument (default isincrement
), instead of column type. Column type must be passed in options object, e.g.@PrimaryGeneratedColumn({ type: "bigint"})
.@PrimaryColumn
now does not acceptgenerated
parameter in options. Use@Generated
or@PrimaryGeneratedColumn
decorators instead.- Logger interface has changed. Custom logger supply mechanism has changed.
- Now
logging
options in connection options is simple "true", or "all", or list of logging modes can be supplied. - removed
driver
section in connection options. Define options right in the connection options section. Embedded
decorator is deprecated now. use@Column(type => SomeEmbedded)
instead.schemaName
in connection options is removed. Useschema
instead.TYPEORM_AUTO_SCHEMA_SYNC
env variable is now calledTYPEORM_SYNCHRONIZE
.schemaSync
method inConnection
has been renamed tosynchronize
.getEntityManager
has been deprecated. UsegetManager
instead.@TransactionEntityManager
is now called@TransactionManager
now.EmbeddableEntity
,Embedded
,AbstractEntity
decorators has been removed. There is no need to useEmbeddableEntity
andAbstractEntity
decorators at all - entity will work as expected without them. Instead of@Embedded(type => X)
decorator now@Column(type => X)
must be used instead.tablesPrefix
,autoSchemaSync
,autoMigrationsRun
,dropSchemaOnConnection
options were removed. UseentityPrefix
,synchronize
,migrationsRun
,dropSchema
options instead.- removed
persist
method from theRepository
andEntityManager
. Usesave
method instead. - removed
getEntityManager
fromtypeorm
namespace. UsegetManager
method instead. - refactored how query runner works, removed query runner provider
- renamed
TableSchema
intoTable
- renamed
ColumnSchema
intoTableColumn
- renamed
ForeignKeySchema
intoTableForeignKey
- renamed
IndexSchema
intoTableIndex
- renamed
PrimaryKeySchema
intoTablePrimaryKey
NEW FEATURES
- added
mongodb
support. - entity now can be saved partially within
update
method. - added prefix support to embeddeds.
- now embeddeds inside other embeddeds are supported.
- now relations are supported inside embeds.
- now relations for multiple primary keys are generated properly.
- now ormconfig is read from
.env
,.js
,.json
,.yml
,.xml
formats. - all database-specific types are supported now.
- now migrations generation in mysql is supported. Use
typeorm migrations:generate
command. getGeneratedQuery
was renamed togetQuery
inQueryBuilder
.getSqlWithParameters
was renamed togetSqlAndParameters
inQueryBuilder
.- sql queries are highlighted in console.
- added
@Generated
decorator. It can acceptstrategy
option with valuesincrement
anduuid
. Default isincrement
. It always generates value for column, except when column defined asnullable
and user setsnull
value in to column. - added logging of log-running requests.
- added replication support.
- added custom table schema and database support in
Postgres
,Mysql
andSql Server
drivers. - multiple bug fixes.
- added ActiveRecord support (by extending BaseEntity) class
Connection
how hascreateQueryRunner
that can be used to control database connection and its transaction stateQueryBuilder
is abstract now and all different kinds of query builders were created for different query types -SelectQueryBuilder
,UpdateQueryBuilder
,InsertQueryBuilder
andDeleteQueryBuilder
with individual method available.
0.0.11
- fixes #341 - issue when trying to create a
OneToOne
relation withreferencedColumnName
where the relation is not between primary keys
0.0.10
- added
ObjectLiteral
andObjectType
into main exports - fixed issue fixes #345.
- fixed issue with migration not saving into the database correctly. Note its a breaking change if you have run migrations before and have records in the database table, make sure to apply corresponding changes. More info in #360 issue.
0.0.9
- fixed bug with indices from columns are not being inherited from parent entity #242
- added support of UUID primary columns (thanks @seanski)
- added
count
method to repository and entity manager (thanks @aequasi)
0.0.8
- added complete babel support
- added
clear
method toRepository
andEntityManager
which allows to truncate entity table - exported
EntityRepository
intypeorm/index
- fixed issue with migration generation in #239 (thanks to @Tobias4872)
- fixed issue with using extra options with SqlServer #236 (thanks to @jmai00)
- fixed issue with non-pooled connections #234 (thanks to @benny-medflyt)
- fixed issues: #242, #240, #204, #219, #233, #234
0.0.7
- added custom entity repositories support
- merged typeorm-browser and typeorm libraries into single package
- added
@Transaction
decorator - added exports to
typeorm/index
for naming strategies - added shims for browsers using typeorm in frontend models, also added shim to use typeorm with class-transformer library on the frontend
- fixed issue when socketPath could not be used with mysql driver (thanks @johncoffee)
- all table decorators are renamed to
Entity
(Table
=>Entity
,AbstractTable
=>AbstractEntity
,ClassTableChild
=>ClassEntityChild
,ClosureTable
=>ClosureEntity
,EmbeddableTable
=>EmbeddableEntity
,SingleTableChild
=>SingleEntityChild
). This change is required because upcoming versions of orm will work not only with tables, but also with documents and other database-specific "tables". Previous decorator names are deprecated and will be removed in the future. - added custom repositories support. Example in samples directory.
- cascade remove options has been removed from
@ManyToMany
,@OneToMany
decorators. Also cascade remove is not possible from two sides of@OneToOne
relationship now. - fixed issues with subscribers and transactions
- typeorm now has translation in chinese (thanks @brookshi)
- added
schemaName
support for postgres database #152 (thanks @mingyang91) - fixed bug when new column was'nt added properly in sqlite #157
- added ability to set different types of values for DEFAULT value of the column #150
- added ability to use zero, false and empty string values as DEFAULT values in #189 (thanks to @Luke265)
- fixed bug with junction tables persistence (thanks @Luke265)
- fixed bug regexp in
QueryBuilder
(thanks @netnexus) - fixed issues #202, #203 (thanks to @mingyang91)
- fixed issues #159, #181, #176, #192, #191, #190, #179, #177, #175, #174, #150, #159, #173, #195, #151
0.0.6
- added
JSONB
support for Postgres in #126 (thanks @CreepGin@CreepGin) - fixed in in sqlite query runner in #141 (thanks @marcinwadon)
- added shortcut exports for table schema classes in #135 (thanks @eduardoweiland)
- fixed bugs with single table inheritance in #132 (thanks @eduardoweiland)
- fixed issue with
TIME
column in #134 (thanks @cserron) - fixed issue with relation id in #138 (thanks @mingyang91)
- fixed bug when URL for pg was parsed incorrectly #114 (thanks @mingyang91)
- fixed bug when embedded is not being updated
- metadata storage now in global variable
- entities are being loaded in migrations and can be used throw the entity manager or their repositories
- migrations now accept
EntityMetadata
which can be used within one transaction - fixed issue with migration running on windows #140
- fixed bug with with Class Table Inheritance #144
0.0.5
- changed
getScalarMany
togetRawMany
inQueryBuilder
- changed
getScalarOne
togetRawOne
inQueryBuilder
- added migrations support
0.0.4
- fixed problem when
order by
is used withlimit
- fixed problem when
decorators-shim.d.ts
exist and does not allow to import decorators (treats like they exist in global) - fixed Sql Server driver bugs
0.0.3
- completely refactored persistence mechanism:
- added experimental support of
{ nullable: true }
in relations - cascade operations should work better now
- optimized all queries
- entities with recursive entities should be persisted correctly now
- added experimental support of
- now
undefined
properties are skipped in the persistence operation, as well asundefined
relations. - added platforms abstractions to allow typeorm to work on multiple platforms
- added experimental support of typeorm in the browser
- breaking changes in
QueryBuilder
:getSingleResult()
renamed togetOne()
getResults()
renamed togetMany()
getResultsAndCount()
renamed togetManyAndCount()
- in the innerJoin/leftJoin methods now no need to specify
ON
- in the innerJoin/leftJoin methods no longer supports parameters, use
addParameters
orsetParameter
instead. setParameters
is now works just likeaddParameters
(because previous behaviour confused users),addParameters
now is deprecatedgetOne
returnsPromise<Entity|undefined>
- breaking changes in
Repository
andEntityManager
:findOne
andfindOneById
now returnPromise<Entity|undefined>
instead ofPromise<Entity>
- now typeorm is compiled into
ES5
instead ofES6
- this allows to run it on older versions of node.js - fixed multiple issues with dates and utc-related stuff
- multiple bugfixes
0.0.2
- lot of API refactorings
- complete support TypeScript 2
- optimized schema creation
- command line tools
- multiple drivers support
- multiple bugfixes
0.0.1
- first stable version, works with TypeScript 1.x