fix(deps): update dependency typeorm to v0.3.17
This MR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| typeorm (source) | 0.2.44 -> 0.3.17 |
Release Notes
typeorm/typeorm
v0.3.17
Bug Fixes
- #10040 TypeORM synchronize database even if it is up to date (#10041) (b1a3a39)
- add missing await (#10084) (f5d4397)
v0.3.16
Bug Fixes
- add
trustServerCertificateoption toSqlServerConnectionOptions(#9985) (0305805), closes #8093 - add directConnection options to MongoDB connection (#9955) (e0165e7)
- add onDelete option validation for oracle (#9786) (938f94b), closes #9189
- added instanceName to options (#9968) (7c5627f)
- added transaction retry logic in cockroachdb (#10032) (607d6f9)
- allow json as alias for longtext mariadb (#10018) (2a2bb4b)
- convert the join table ID to the referenceColumn ID type (#9887) (9460296)
- correct encode mongodb auth credentials (#10024) (96b7ee4), closes #9885
- create correct children during cascade saving entities with STI (#9034) (06c1e98), closes #7758 #7758 #9033 #9033 #7758 #7758
- express option bug in init command (#10022) (5be20e2)
- for running cli-ts-node-esm use exit code from child process (#10030) (a188b1d), closes #10029
- mongodb typings breaks the browser version (#9962) (99bef49), closes #9959
- RelationIdLoader has access to queryPlanner when wrapped in transaction (#9990) (21a9d67), closes #9988
- resolve duplicate subscriber updated columns (#9958) (3d67901), closes #9948
- select + addOrderBy broke in 0.3.14 (#9961) (0e56f0f), closes #9960
- support More/LessThanOrEqual in relations (#9978) (8795c86)
Features
Reverts
v0.3.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
v0.3.14
Bug Fixes
- drop xml & yml connection option support. Addresses security issues in underlying dependency (#9930) (7dac12c)
Features
v0.3.13
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)
v0.3.12
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
FindOptionsWherebehavior 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
whereparameter 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)
v0.3.11
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
initcommand (#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)
v0.3.10
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 MR 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
v0.3.9
v0.3.8
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)
v0.3.7
Bug Fixes
- add missing
enumNamesupport 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
v0.3.6
Features
- add
for_key_share("FOR KEY SHARE") lock mode for postgres driver (#8879) (4687be8), closes #8878 - new driver: Cloud Spanner (#8730) (62518ae)
v0.3.5
Bug Fixes
-
.saverepository 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-commonjsandcli-ts-node-esmon 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 initcommand (#8820)
v0.3.4
Bug Fixes
- BaseEntity.reload method regression and made
findOneto 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)
v0.3.3
Bug Fixes
- improve initialization of custom repository (#8782) (52a641c)
- resolve entities correctly in datasource when globs are specified (#8778) (a641c5d)
Features
v0.3.2
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
v0.3.1
Bug Fixes
- #10040 TypeORM synchronize database even if it is up to date (#10041) (b1a3a39)
- add missing await (#10084) (f5d4397)
v0.3.0
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
targetnow 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)
-
Connectionwas renamed toDataSource. OldConnectionis 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 tojoinorquery.-
join- loads relations using SQLJOINexpression -
query- 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,findAndCountBymethods toBaseEntity,EntityManagerandRepository:
const users = await userRepository.findBy({
name: "Michael"
})
Overall find* and count* method signatures where changed, read the "breaking changes" section for more info.
- new
selecttype 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
relationstype 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
ordertype signature inFindOptions(used infind*methods):
userRepository.find({
order: {
id: "ASC"
}
})
Now supports nested order by-s:
userRepository.find({
order: {
photos: {
album: {
name: "ASC"
},
},
}
})
- new
wheretype 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 inwherestatement, for example:
userRepository.find({
where: {
photos: MoreThan(10),
}
})
Gives you users with more than 10 photos.
-
booleancan be applied for relations inwherestatement, for example:
userRepository.find({
where: {
photos: true
}
})
BREAKING CHANGES
-
minimal Node.JS version requirement now is
14+ -
drop
ormconfigsupport.ormconfigstill 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.
-
clioption fromBaseConnectionOptions(nowBaseDataSourceOptionsoptions) 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
migrationsRunandsynchronizeenabled in connection options). -
aurora-data-apidriver now is calledaurora-mysql -
aurora-data-api-pgdriver now is calledaurora-postgres -
EntityManager.connectionis nowEntityManager.dataSource -
Repositorynow has a constructor (breaks classes extending Repository with custom constructor) -
@TransactionRepository,@TransactionManager,@Transactiondecorators 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,findAndCountmethods now only acceptFindOptionsas 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.
-
findByIdswas deprecated, usefindBymethod instead in conjunction withInoperator, for example:
userRepository.findBy({
id: In([1, 2, 3])
})
This change was made to provide a more type-safe approach for data querying.
-
findOneandQueryBuilder.getOne()now returnnullinstead ofundefinedin the case if it didn't find anything in the database. Logically it makes more sense to returnnull. -
findOnenow 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.
-
whereinFindOptions(e.g.find({ where: { ... })) is more sensitive to input criteria now. -
FindConditions(whereinFindOptions) was renamed toFindOptionsWhere. -
nullas value inwhereused 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.
-
orderinFindOptions(used infind*methods) doesn't support ordering by relations anymore. Define relation columns, and order by them instead. -
whereinFindOptions(used infind*methods) previously supportedObjectLiteralandstringtypes. Now both signatures were removed. ObjectLiteral was removed because it seriously breaks the type safety, andstringdoesn't make sense in the context ofFindOptions. UseQueryBuilderinstead. -
MongoRepositoryandMongoEntityManagernow use new types calledMongoFindManyOptionsandMongoFindOneOptionsfor 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)
DEMRECATIONS
-
all CLI commands do not support
ormconfiganymore. You must specify a file with data source instance instead. -
entities,migrations,subscribersoptions insideDataSourceOptionsacceptingstringdirectories 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
getCustomRepositoryused within transactions is deprecated. UsewithRepositorymethod instead. -
Connection.isConnectedis deprecated. Use.isInitializedinstead. -
selectinFindOptions(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.
-
relationsinFindOptions(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.
-
joininFindOptions(used infind*methods) is deprecated. UseQueryBuilderto build queries containing manual joins. -
Connection,ConnectionOptionsare deprecated, new names to use are:DataSourceandDataSourceOptions. To create the same connection you had before use a new syntax:new DataSource({ /*...*/ }). -
createConnection(),createConnections()are deprecated, sinceConnectionis calledDataSourcenow, 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()andConnectionManageritself are deprecated - nowConnectionis 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 loading -
AbstractRepositoryis deprecated. Use new way of custom repositories creation. -
Connection.nameandBaseConnectionOptions.nameare 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 versions -
alternative find operators- using$any,$in,$likeand other operators inwherecondition.
v0.2.45
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
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.