- added configurable handling for null/undefined in where clauses (ignore, SQL NULL, or throw) across queries, query builders, and repository/entity-manager methods
* fix: resolve array modification bug in QueryRunner drop methods
Fix iteration bug in QueryRunner implementations where dropping multiple
database objects (columns, indices, foreign keys, unique constraints) would
skip elements due to in-place array modification during iteration.
The issue occurred when methods like dropColumns(), dropIndices(),
dropForeignKeys(), and dropUniqueConstraints() iterated over arrays while
simultaneously modifying them by removing elements. This caused a classic
"off-by-one" iteration bug where alternate elements would be skipped.
Changes:
- Update all affected QueryRunner drop methods to iterate over a shallow
copy of the input array using [...array] spread syntax
- Add comprehensive regression tests in test/github-issues/11563/
- Test coverage includes all affected drivers: Postgres, MySQL, SQL Server,
Oracle, CockroachDB, Spanner, SAP, and Aurora MySQL
Affected drivers:
- SpannerQueryRunner
- PostgresQueryRunner
- MysqlQueryRunner
- SqlServerQueryRunner
- OracleQueryRunner
- CockroachQueryRunner
- SapQueryRunner
- AuroraMysqlQueryRunner
Closes#11563
* fix: create multiple indices same column
* chore: functional tests instead of github issues
* fix: handle limit(0) and offset(0) correctly in SelectQueryBuilder
- Fix JavaScript falsy value issue where limit(0) was treated as undefined
- Now limit(0) correctly generates 'LIMIT 0' SQL clause instead of being ignored
- Add helper functions hasLimit/hasOffset to distinguish between undefined and 0
- Add comprehensive test cases for zero value handling in limit/offset/take/skip
- Prevents potential security issue where limit(0) returned all records
Fixes potential data exposure when limit(0) was intended to return empty result
* fix: prettier formatting
* test: expand test coverage for LIMIT/OFFSET edge cases and regression prevention
* chore: enable driver `mssql` for test of issue #3113
* chore: add test case for #11298 to issue #11285 to prevent functionality of #11285
* fix: unhandled find operator with array value for mssql (#11466)
* fixup! fix: unhandled find operator with array value for mssql (#11466)
* Revert "chore: enable driver `mssql` for test of issue #3113"
This reverts commit a302d63eeac5892e920d97705b4230414ef81e6d.
* fixup! chore: add test case for #11298 to issue #11285 to prevent functionality of #11285
---------
Co-authored-by: Christian Forgács <christian@wunderbit.de>
* Add updateAll() methods
* Add deleteAll() methods
* Fix softDelete/restore error messages
* Add test for Repository.delete() with criteria
* Add test for Repository.deleteAll() method
* Move/rename “Repository > delete” test files
* Tweak comments
* Add tests for Repository update methods
* Add updateAll and deleteAll to EntityManager API docs
* Add updateAll and deleteAll to Repository API docs
* Fix tests
* Added a new SQL tagged template feature for executing raw SQL queries with automatic parameter handling.
---------
Co-authored-by: Simon Garner <simon@equalogic.com>
* fix: prevent error when replication is undefined
* fix format
* add test
* update test name
* fix test
* fix test
* skip test
* add unit test
* fix unit test
* fix unit test
* perf(query-runner): use Date.now() intead of +new Date()
* perf: use Date.now() instead of new Date().getTime()
---------
Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
Co-authored-by: Mike Guida <mike@mguida.com>
Add "enableQueryTimeout" option to MysqlConnectionOptions. When enabled the value of "maxQueryExecutionTime" will be passed to mysql driver as query timeout.
---------
Co-authored-by: Mike Guida <mike@mguida.com>
Remove unused `type` parameter from functions supplied to decorators in tests and sample code. This resolves 477 eslint unused var warnings.
All changes are modifying functions in test or sample code of the following style:
1. `@OneToMany((type) => Entity, ...)` to `@OneToMany(() => Entity)`
2. `@ManyToOne((type) => Entity, ...)`
3. `@ManyToMany((type) => Entity, ...)`
4. `@OneToOne((type) => Entity, ...) `
Note that we don't actually ever call this function with an argument.
Including jsdoc for typehinting
Add esm as an option in the migrate cli
Update the documentation for the JS migrations
fixes#10801
Co-authored-by: Mike Guida <mike@mguida.com>
* feat: add new foreign key decorator, and entity schemas options
This new feature adds the ability to create foreign key constraints without entity relations, using `@ForeignKey()` decorator or entity schema options.
Closes: #4569
* fix: resolve issues in insert query orUpdate method with postgres driver
This fix make use of table name alias in WHERE clause of onUpdate method with postgres driver to avoid throwing error
Closes: #11077
* test: update insert on conflict test
---------
Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
* Skip tests that don't work on Windows
* Bring back tests on Windows
* Skip the test on all platforms exept Windows
* Make the test run only on Windows
* Add simple winodws test
* fix cli test on Windows
* let's see if this test passes on linux
* limit test to Windows and run format
* Add withPlatform test helper
* Mock platform in file path tests using withPlatform()
* Fix test: relative paths should not change on non-win32 platforms
* Lowercase relative path on non-win32 platform
* test: add better-sqlite3 and sqlite for Windows tests
---------
Co-authored-by: Simon Garner <simon@equalogic.com>