5411 Commits

Author SHA1 Message Date
Umed Khudoiberdiev
a909d5b697 version bump 0.3.17 2023-06-20 12:47:22 -07:00
juliengbt
b1a3a39504
fix: #10040 TypeORM synchronize database even if it is up to date (#10041)
* test: #10040 TypeORM synchronize database even if it is up to date

* formating

* fix: TypeORM synchronize database even if it is up to date #10040
2023-06-20 12:38:55 -07:00
Felix Gohla
7108cc6f71
chore: use new CircleCI convenience images (#10101)
This commit updates the CircleCI images to the new convenience images
(cimg/... instead of circleci/...), as the old ones were deprecated.
Sadly, they do not come with major-only tags.
See the following blog post for more information:
https://circleci.com/docs/next-gen-migration-guide/

Also, the apt cache was not updated before downloading additional
packages.
Thus, an update of the apt cache should fix getting the right packages.

Related to #10100
2023-06-20 07:36:35 -07:00
pro100kryto
f5d43975db
fix: add missing await (#10084) 2023-06-19 11:10:47 -07:00
Felix Gohla
d4607a8672
test: fix test from #9034 with STI for Oracle (#10037)
Oracle does not have a `onUpdate: 'CASCADE'` option.
Thus, the test fixtures had to be adapted.
Checking for the correct `onUpdate` actions for Oracle was introduced in #9786.
2023-05-10 14:40:15 +05:00
Umed Khudoiberdiev
abb9079f2b version bump 0.3.16 2023-05-09 23:57:55 +05:00
AlexMesser
607d6f9595
fix: added transaction retry logic in cockroachdb (#10032)
* added transaction retry logic in cockroachdb

* added option to control max transaction retries;
added delay before transaction retry;
updated docs;

* fixes in retry logic

* enable storing queries after retrying transaction
2023-05-09 23:46:07 +05:00
LoneRifle
8795c864e8
fix: support More/LessThanOrEqual in relations (#9978)
* test(select-buildwhere): exercise More/LessThanOrEqual for relations

Extract the relevant test suite from functional/find-options, modifying
the tests to use the equivalent More/LessThanOrEqual operators

* fix(select-buildwhere): support More/LessThanOrEqual for relations

Tweak `buildWhere()` to recognise more find operators and output
the SQL equivalent

- Recognise `moreThanOrEqual` and `lessThanOrEqual`, in addition to
  `moreThan` and `lessThan`
- If the find operator ends with `OrEqual`, append `=` to the
  SQL operator

* code style change

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2023-05-09 22:32:41 +05:00
Felix Gohla
06c1e98ae2
fix: create correct children during cascade saving entities with STI (#9034)
* test: test saving disciminators STI, cascading

This commit adds an test for checking whether discriminators are saved
correctly when saving a field with cascade that uses
Single-Table-Inheritance.

Related to: #7758

* fix: Create correct children with STI

This commit fixes the `create` function for EntityManager and Repository
to create entities of correct type when using Single Table Inheritance.
Refactors the otherwise repeated code into a new function on
EntityMetadata.

Related to: #7758

* test: check STI type setting discriminator manually

Related to: #9033

* feature: allow setting discriminator value manually

This commit allows using an instance of a base class in a
Single Table Inheritance scenario and setting the discriminator value
manually.

Related to: #9033

* test: test saving disciminators with trees in STI

This commit adds an test for checking whether discriminators are saved
correctly when saving a tree that also uses Single-Table-Inheritance.

Related to: #7758

* fix: Create correct children with STI and trees

This commit fixes the `create` function for EntityManager and TreeRepository
to create entities of correct type when using Single Table Inheritance
and complex inheritance with Trees.

Related to: #7758
2023-05-09 22:14:01 +05:00
leoojg
96b7ee44b2
fix: correct encode mongodb auth credentials (#10024)
* fix: correct encode mongodb auth credentials

when use the special character `@` into mongodb password result in unauthorized because the it has no encoding

Closes: #9885

* we need to close connections at the end

* fixed js issue

* adjust import statement

* style: run prettier

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2023-05-09 16:25:49 +05:00
tqh177
9460296147
fix: convert the join table ID to the referenceColumn ID type (#9887)
* fix: Convert the join table ID to the referenceColumn ID type

* test: add auto-increment-id-as-string test

* style: format auto-increment-id-as-string test
2023-05-09 15:59:06 +05:00
ertl
938f94bded
fix: add onDelete option validation for oracle (#9786)
* fix: add onDelete option validation for oracle

Closes: #9189

* refactor: move fk validation logic to EntityMetadataValidator.ts

* fix: skip assertion for other databases

* fix: styles

---------

Co-authored-by: ke <ke@sbs.co.at>
2023-05-09 15:49:22 +05:00
Sergey Pahuta
a188b1d9f4
fix: for running cli-ts-node-esm use exit code from child process (#10030)
Use child process exit code in parent process to properly indicate that child process (migration running) fails

Closes: #10029
2023-05-09 15:45:50 +05:00
Jens Horch
7c5627f272
fix: added instanceName to options (#9968)
* added instanceName to options

* run prettier

---------

Co-authored-by: Jens Horch <horch@hector.de>
2023-05-09 15:41:50 +05:00
Joe Rybarczyk
03058055df
fix: add trustServerCertificate option to SqlServerConnectionOptions (#9985)
* fix: add missing 'trustServerCertificate' option to SqlServerConnectionOptions interface

Closes: #8093

* docs: add `trustServerCertificate` description to mssql data source options docs

* fix: consistency between jsdoc and docs

---------

Co-authored-by: jrybarczyk <jrybarczyk@exclusiveresorts.com>
2023-05-09 15:31:27 +05:00
Riqwan Thamir
21a9d67fcf
fix: RelationIdLoader has access to queryPlanner when wrapped in transaction (#9990)
fix issue - createQueryBuilder in repository loses queryplanner when wrapped in txn upsteam until RelationIdLoader

Closes: #9988
2023-05-09 15:28:30 +05:00
YoungKi Lyu
5be20e2bcd
fix: express option bug in init command (#10022)
* Fix express option bug in init command

* fixed esm support in command

* fix linter

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2023-05-09 15:23:01 +05:00
smith-xyz
2a2bb4bdc1
fix: allow json as alias for longtext mariadb (#10018) 2023-05-09 14:54:52 +05:00
Umed Khudoiberdiev
54f4f8986a revert: "refactor: remove date-fns package (#9634)"
This reverts commit 1fcd9f38
2023-05-09 13:45:13 +05:00
spotykatch
99bef49128
fix: mongodb typings breaks the browser version (#9962)
* fix: exclude mongodb typings from browser

Closes: #9959

fix: delete unnessecary dummy file

* another fix for bson typings problem in browser

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2023-05-09 13:42:23 +05:00
smith-xyz
d8a2e3730f
feat: mariadb uuid inet4 inet6 column data type support (#9845)
* feat: mariadb inet4, inet6, uuid data type support

* refactor: cleanup unnecessary methods

* style: mysqldriver formatting

* fix: handle length column metadata mariadb uuid

* fix: 8832 test suite to verify errors correctly

* style: fix 8832 test formatting

* fix: 8832 error testing cleanup

* fix: remove defaulting column type feature

* style: fix formatting

* fix: remove unnecessary dbms error test

* fix: remove unused import in test

* fix: ensure defaulting uuid generation column type
2023-04-25 11:36:20 +05:00
Eliya Cohen
f5b93c14b5
refactor: query methods should accept generic for return type (#9957)
* query should accept generics

* Update DataSource.ts
2023-04-18 22:54:08 +05:00
Umed Khudoiberdiev
0e56f0fcf8
fix: select + addOrderBy broke in 0.3.14 (#9961)
* added test for #9960
* fixing the issue
* limiting only to postgres because of NULLS FIRST syntax
* lint
2023-04-18 22:52:05 +05:00
spotykatch
3d67901fde
fix: resolve duplicate subscriber updated columns (#9958)
Closes: #9948
2023-04-18 14:40:28 +05:00
Jo YoHan
b06404962b
docs: update entity-manager-api.md (#9956)
typo:
const timber = await manager.findOne(User, { firstName: "Timber" })   →   const timber = await manager.findOneBy(User, { firstName: "Timber" })

Co-authored-by: Jo YoHan <37216082+oxyrinchus@users.noreply.github.com>
2023-04-18 12:07:10 +05:00
Alexis Fournier
e0165e75ee
fix: add directConnection options to MongoDB connection (#9955)
Co-authored-by: afournier <afournier@solocal.com>
2023-04-17 21:03:00 +05:00
Ezekiel Adetoro
68aa573262
docs: issue #8860 (#9951)
* fixed: issue #8860

* example looks rough

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2023-04-15 18:29:15 +05:00
Umed Khudoiberdiev
589056162c version bump 0.3.15 2023-04-15 18:26:02 +05:00
Umed Khudoiberdiev
f1c56626b9 fixed compiler error 2023-04-15 15:22:14 +05:00
Lucian Mocanu
51eecc2aa0
fix: prevent unique index identical to primary key (all sql dialects) (#9940)
Co-authored-by: Lucian Mocanu <lucian.mocanu@nexontis.com>
2023-04-15 14:52:59 +05:00
RustySol
159c60a6e8
fix: make cache optional fields optional (#9942)
This patch allows the getFromCache caller to only pass in
identifier or query field, as getFromCache already handles
the identifier and query field checks

Co-authored-by: ru.c <ru@shuffle.com>
2023-04-15 14:47:12 +05:00
☃ Elliot Shepherd
06291cfb31
docs: wrong documentation on QueryBuilder.getCount() (#9935) 2023-04-15 14:38:31 +05:00
Bengt Weiße
7ee6232143
refactor: combine sqlite json and simple-json handling (#9937) 2023-04-15 14:37:46 +05:00
Stafford Williams
80ae9043ae
chore: better console.log (#9924) 2023-04-15 14:33:34 +05:00
Alankarsharma
83c6c0ed80
fix: SelectQueryBuilder builds incorrectly escaped alias in Oracle when used on entity with composite key (#9668)
* Update SelectQueryBuilder.ts

Bug fix, In case a unique alias is created in first query then result was not getting mapped properly.

* lint fix

---------

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2023-04-15 14:23:32 +05:00
mptr
f6a3ce732d
feat: support for the latest mongodb v5 (#9925)
* fix: add support for mongodb driver v5

This new fix allow support to mongodb driver v5

Closes: #7907

* refactor: remove callback from MongoDriver connect

* fix: check for propertyName in transform

* fix: add support for mongodb driver v5

This new fix allow support to mongodb driver v5

Closes: #7907

* feat: mongodb 5.2.0 typings

* fix: instanceof ObjectId check

Instanceof check now no longer references to just the
type but the loaded class ref instead.

* test: fix test name to mongodb v5

---------

Co-authored-by: Matheus Melo Antiquera <matheusantiquera@finchsolucoes.com.br>
Co-authored-by: tgrassl <grassl.timon@gmail.com>
Co-authored-by: Matheus Melo Antiquera <matheus.melo.a@hotmail.com>
2023-04-15 13:30:01 +05:00
mptr
3a72e35081
test: cli init with local typeorm package (#9926)
* test: cli init with local typeorm package

Uses the locally built files instead of the typeorm
package published to npmjs. This enables testing project
initialisation with unreleased typeorm package versions.

* fix: enable init cli to be testable w non-releases
2023-04-13 05:24:44 +05:00
mptr
4240258b50
ci: wait if oracle db is enabled in test suite (#9946) 2023-04-13 05:21:36 +05:00
Umed Khudoiberdiev
115059de91 added package lock 2023-04-10 10:45:26 +05:00
Umed Khudoiberdiev
5e3c565dce version bump 0.3.14 2023-04-09 11:39:56 +05:00
Umed Khudoiberdiev
7dac12c2b1
fix: drop xml & yml connection option support (#9930) 2023-04-09 11:30:28 +05:00
Dmitry Zotov
daf1b47a60 fix: wrong dependency version in init command 2023-04-06 15:30:05 +05:00
Umed Khudoiberdiev
0194f179fe version bump 2023-04-06 14:25:06 +05:00
Umed Khudoiberdiev
12e9db07b6
feat: QueryBuilder performance optimizations (#9914)
* small optimization in driver utils - shortening alias become a bit faster

* added entity metadatas as a map into DataSource for search optimization purposes

* ultra small optimization - looks like symbols work slow. Need to re-think its usage

* small optimizations to improve performance

* replace property names optimization

* tsc error fix

* big optimization - now replacePropertyNames executed only for the final SQL query

* trying to fix the bug in select query builder with orders not being properly replaced with their aliaces

* fixing tests
2023-04-06 14:21:40 +05:00
AlexMesser
f1330ad6e2
fix: firstCapital=true not working in camelCase() function 2023-04-06 14:10:38 +05:00
Jose Toscano
a11809e1b2
fix: handles "query" relation loading strategy for TreeRepositories (#9680)
Adds support to loading entities' relationships with "query" strategy for TreeRepositories
Previously the default method was "join". Implementation is done recursively for n-level
relations

Closes: #9673
2023-04-06 13:59:30 +05:00
acuthbert
947ffc3432
feat: leftJoinAndMapOne and innerJoinAndMapOne map result to entity (#9354)
* feat: leftJoinAndMapOne and innerJoinAndMapOne now map correctly with QueryBuilder

When joining to a query builder instead of an entity or table name, typeorm now
correctly supports mapping the result to an entity. This introduces a new argument
to the join functions to supply the join attributes with a source of meta data
for the mapping

For example:

const loadedPost = await connection.manager
      .createQueryBuilder(Post, "post")
      .innerJoinAndMapOne(
           "post.tag",
           qb => qb.from(Tag, "tag"),
           "tag",
           "tag.id = post.tagId",
           undefined,
           // The next argument is new - it helps typeorm know which entity
           // to use to complete the mapping for a query builder.
           Tag
      )
      .where("post.id = :id", { id: post.id })
      .getOne()

* style: Auto Formatting

* trigger CircleCI

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2023-04-06 13:51:43 +05:00
ertl
de1228deac
fix: transform values for FindOperators #9381 (#9777)
* fix: transform values for FindOperators

Closes: #9381

* refactor: simplify correction

do not transform value, when it is a FindOperator

Closes: #9381

* fix: transform value of FindOperator when it is not a FindOperator

Closes: #9381 #9816

* fix: perform transformation on the array instead of each value in case of JsonContains

* fix: remove anti pattern, correct functionality for operators without multiple parameter

* fix: correct linting

* fix: resolve issue when parameterValue is not an instanceof FindOperator

---------

Co-authored-by: ke <ke@sbs.co.at>
2023-04-06 13:12:50 +05:00
sinopsysHK
197cc05e90
fix: prevent foreign key support during migration batch under sqlite (#9775)
* fix: prevent foreign keys support during migration batch under sqlite

Schema changes in migrations batch cannot be done on table which has referring
 foreign keys with ON DELETE CASCADE without deleting its content.

Closes: #9770

* Update MigrationExecutor.ts

* Update command.ts

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2023-04-06 13:12:10 +05:00
Nguyen Ba Hung
4ac8c00117
feat: add support for json datatype for sqlite (#9744) 2023-04-06 12:31:46 +05:00