1829 Commits

Author SHA1 Message Date
Filip Wróbel
ef64bfc6c5
test: update multiple nested embedded entities (#9696)
* test: update multiple nested embedded entities

Closes: #1200

* test: update multiple nested embedded entities - fix for ORA-00972 - shorter names

Closes: #1200

* test: correct test name for issue 1200

Closes: #1200
2023-01-28 16:11:10 +05:00
Lukas Spiss
b937ae4afd
test: Add test to prove that issue #2331 is resolved (#9688) 2023-01-28 16:07:55 +05:00
변경연
6b37e3818b
fix: remove unnecessary .js extension in imports (#9713)
* fix: remove extension when importing file

* removed unnecessary .js extension in imports

---------

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2023-01-28 16:01:24 +05:00
Mattias Fjellvang
defb409f56
feat: support time travel queries, upsert, enums, spatial types in cockroachdb (#9128)
* feature: adds support for enum type (fixes #9068)

* temporarily ran package to test on different repo

* playing around - bumped version

* Revert "playing around - bumped version"

This reverts commit 7df4adb3e698419c174c2daee88614f8dafdbb6c.

* Revert "temporarily ran package to test on different repo"

This reverts commit 48f394e8eb32c22fe757010b446c85740bf80b5f.

* feat: add support for geometry data type

* feature: properly hydrate enum array values

* feature: adds support for geography and geometry for cockroachdb

* bugfix: fixes issue with primary generated columns being invalid column type (fixes #8532)

* Revert "bugfix: fixes issue with primary generated columns being invalid column type (fixes #8532)"

This reverts commit e00cdb090638d34668e3e10acd5f8267fe3bd028.

* bugfix: type casts to string when using ANY

* feature: cast geometry/geography to geojson

* feature: added references to srid

* bugfix: prevent error if trying to close already closed connection

* feature: added cockrachodb as part of postgres family

* feature: ensures support for spatial columns for cockroachdb

* feature: adds support for UPSERT for CockroachDB (fixes #9199)

* minor: added TODO; unsure how to achieve this

* feature: adds support for time travelling queries for cockroachdb

* bugfix: only run time travel query on SELECT statements

* refactor: changed UsertType from 'upsert' to 'primary-key' since this is more logical

* feature: added posibility to set timeTravelQuery to false, instead of the parameter function; help for disabling time travel queries during tests

* feature: allow timeTravelQueries in find* queries

* bugfix: when using timetravel queries with joinAttributes it now prevents error 'AS OF SYSTEM TIME must be in top level' error

* lint

* minor fix

* fixed failing test

* implemented ENUM type;
added tests;

* fixed failing tests

* fixed failing test

* fixed spatial types synchronization;
implemented spatial indices;
added tests for spatial columns;

* refactored Time Travel Query functionality;
removed TTQ from find options;
added tests for TTQ;

* added docs for Time Travel Queries

* minor changes

* added GeoJSON types;
other minor fixes;

* updated docs

* updated docs

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2023-01-03 19:25:22 +05:00
James Jurach
18b659d129
fix: synchronizing View with schema broken for oracle (#9602)
* fix view+schema broken for oracle

* apply prettier

* fixed missing schema in loadViews();
added test (with .only)

* removed .only

Co-authored-by: James Jurach <James.Jurach@apiture.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>
2022-12-29 20:06:48 +05:00
Adrian Parry
67973b4726
fix: materialized hints support for cte (#9605)
Fix implementation of materialized hints in common table expressions
Previous behavior did not account for NOT MATERIALIZED hints, also
placed materialized hints in wrong place (before "AS")

Co-authored-by: Adrian Parry <adrian.parry@reign.cl>
2022-12-29 19:55:54 +05:00
sinkhaha
8668c29d83
feat: support busy_timeout param parameter for sqlite (#9623)
Co-authored-by: sinkhaha <1468709606@qq.com>
2022-12-29 18:52:55 +05:00
ayuvlasenko
4eda5df869
fix: allow to pass ObjectLiteral in mongo find where condition (#9632)
Closes: #9518
2022-12-29 18:51:54 +05:00
Tim Beyer
6ba48bdc1b
feat: allow per-migration control over transaction behavior (#9459)
Closes #7087
2022-12-03 21:35:41 +05:00
Derek Bonner
2c54381815
feat: allow for partial index conditions for on conflict statments in postgres (#8971)
* feat: allow for partial index conditions for on conflict statments in postgres

* fix: change variable to match postgres documentation and convert from array to string type

* fix: generalize use of index predicate. add documentation and expand test cases

* lint fix

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>
2022-12-03 21:11:10 +05:00
Bartłomiej Rutkowski
93e14a928b
feat: Add synchronize to @JoinTable (#9442)
* feat: Add synchronize option to @JoinTable

Add synchronize option to @JoinTable. It allows to ignore JoinTable when syncing and generating migrations.

Closes #3443

* removed only

* lint fix

Co-authored-by: Bartlomiej Rutkowski <brutkowski@tilt.app>
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>
2022-12-03 21:05:24 +05:00
Morteza PRK
598e26980d
feat: implement exists query method (#9303)
Adding `Exists` method to query builder and EntityManager, to check whether a row exists given the conditions

Closes: #2815

Co-authored-by: mortzprk <mortz.prk@gmail.com>
2022-12-03 21:00:18 +05:00
Michael Wolz
53fad8f235
fix: disable transactionSupport option for CordovaDriver (#9391)
* fix: disable transaction support for cordova driver

the cordova-sqlite-storage plugin does not support transactions. fc4133c
introduced an exception when starting a transactions but did not disable
the transactionSupport in general leading to errors when using the
`save` and `remove` method of the `EntityPersistExecutor`. With this PR
the `EntityPersistExecutor` will respect the drivers `transactionSupport`
option.

* docs: add note on transaction limitations for cordova driver
2022-12-03 20:54:23 +05:00
Dan Manastireanu
2473ff0a8e
feat: add parseInt8 option to postgres driver. Closes #9341 (#9435)
* feat: add parseInt8 option to postgres driver

* chore: formatting
2022-12-03 20:28:43 +05:00
4l3ss
93e6b3dd8e
fix: cacheId not used when loading relations with take (#9469)
* fix: cacheId not used loading relations

The cacheId is set to undefined for the main request used for pagination when we load related entities

* fix: tests
2022-12-03 20:16:50 +05:00
Adrian Burlacu
73148c9ad4
feat: add Open DB Flags and URI DB Name in SQLite (#9468)
* Add the open database flags for sqlite3.

* Check for URI before trying to create the DB dir.

* Spacing.

* Add the sqlite open connection flags.

* Spacing.

Co-authored-by: Adrian Burlacu <adrian.burlacu@live.com>
2022-12-03 19:46:49 +05:00
Pavel Petrik
b2824288f8
feat: upsert options conflictPaths as Entity keys (#9365)
* feature: upsert options conflictPaths as Entity keys

* feature: upsert options conflictPaths as object

* feature: upsert options conflictPaths as object

Co-authored-by: Pavel <pavel@loanbase.com>
2022-12-03 19:39:07 +05:00
Gonzalo Rodulfo Martínez
1cb738a701
feat: index support for materialized views of PostgreSQL (#9414)
* feat: Added new indices attribute to View

* feat: Added view indices methods

Such as dropViewIndex, addViewIndices, addViewIndex

Added "View" type in some parameters of methods

* feat: Added view indices support when creating new indices and dropping old indices

* ref: Renamed "table" to "view" in log when dropping view index

* feat: changed order of schema sync operations

To create a new view index, a view has to be created first.

* feat: removed unreachable code

A view object don't have its indices when creation. The indices are added to the view through the createViewIndex method.

* feat: Added view when returning TableIndex

* feat: Added view paths as argument in getViews on log method

* feat: Created createViewIndexSql

This method reuses code from createIndexSql, but eliminates the isSpatial part, because a viewColumn doesn't support this attribute.

* fix: Added missing columns const to createViewIndexSql

* feat: Removed isSpatial attribute when returning TableIndex

* feat: Added unit tests

* fix: Dropped current index to leave unique index on indices array

There was a bug that when asserting the unique index, it would compare with the previous index, even when explicitly selecting the unique index in the indices array.

* ref: lint files

* feat: added "postgres" in enabledDrivers attribute

This is to enable only PostgreSQL for the tests

* feat: added doc for materialized view indices

* ref: lint files

* feat: Added new method to create mat. view indices

This new method goes after creating the views. Aditionally, the views are now created at the end (as it was before)

* ref: prettify files

* feat: revamped tests

Replaced previous unit tests with more significant ones
2022-12-03 19:25:50 +05:00
Patrick Gallagher
d490793c7c
fix: left instead of inner join for where or + optional relations (#9516) 2022-12-03 19:05:21 +05:00
Jeffyter Saraiva
fc3b4f8021
feat: "And" operator in FindOptions (#9489)
Closes #3113
2022-12-03 18:57:17 +05:00
Sakura
658604d0ae
fix: the mpath is incorrect when the parent of the tree entity is null (#9535)
* fix: the mpath is incorrect when the parent of the tree entity is null

* lint: code format

* fix: findTrees not have children

* test: add unit test

* style: format code

* fix: unit test

* fix: unit test

* fix: unit test
2022-12-03 17:21:40 +05:00
Umed Khudoiberdiev
4ec04fa120
feat: added opaque types support over primitives in find-options (#9560)
* added opaque types support over primitives in find-options
* removed lock-verify because of its deprecation
* fixing auto type mapping
2022-11-21 23:24:30 +05:00
Michael Wolz
4a36d0e8c1
fix: boolean parameter escape in SQLiteDriver (#9400)
* fix: sqlite boolean parameter escape

sqlite does not support boolean parameters. Even though sqlite is able to transform true to 1 and false to 0 there might be some limitations with other implementations that build up on this.

Fixes: #1981 (again)

* fix: remove obsolete where boolean value transformation

3cbbe90c already handles the boolean value transformation so it is not necessary to have additional code in the query runner for handling this

* test: add test cases for sqlite query parameter escape

* fix typo
2022-11-05 13:56:51 +05:00
Marvin Kilp
38e0eff18a
fix: resolve issue with migrations and unsigned int columns in aurora-data-api (#9478)
* fix: resolve issue with migrations and unsigned int columns in aurora-data-api

Closes: #9477

* refactor: fix prettier

* refactor: fix prettier again
2022-11-04 17:23:49 +05:00
Ville Laitila
c053257bbe
test: old name fixed in test case name (#9428)
syncSchema was renamed to synchronize but nobody
updated the test case name.
2022-11-04 16:23:17 +05:00
Julian Pömp
cdabaa3028
fix: synchronize with typeorm_metadata table only if needed (#9175)
* fix: create typeorm metadata table before migration, if not exists

Creating a view in a migration results in an error: `QueryFailedError:
relation "typeorm_metadata" does not exist` (see #9173). This fix
creates the table before a migration runs.

Closes: #9173

* refactor: use function from RdbmsSchemaBuilder to create typeorm_metadata table

* test: add test for fix issue #9173

* test: replace describe.only() with describe()

* refactor: apply suggestions from review

* refactor: add syncWithMetadata param to createView function

* style: run npm format

* removed only test

* test: add missing syncWithMetaData parameter in create-view.ts

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2022-09-20 17:27:42 +05:00
Collin
d305e5f9ac
feat: new virtual column decorator (#9339)
* feat: implement new calculated decorator

This new feature change bahviour of typeorm to allow use new calculated decorator

Closes #9323

* feat: implement new virtual decorator

This new feature change bahviour of typeorm to allow use new virtual decorator

Closes typeorm#9323

* feat: Implement new virtual decorator

This new feature change bahviour of typeorm to allow use new virtual decorator

Closes typeorm#9323

* feat: implement new virtual decorator

This new feature change bahviour of typeorm to allow use new calculated decorator

Closes typeorm#9323

* feat: implement new virtual decorator

This new feature change behavior of typeorm to allow use of the new virtual column decorator

Closes typeorm#9323
2022-09-20 17:23:38 +05:00
Jannik Mewes
de15df14ed
feat: orphanedRowAction=disabled (rebase of PR 8285) (#8678)
* updated implementation, using "disable" keyword

* rebase test restructure

* rebase orphanedRowAction tests with keyword "disabled"

* rename test suite files to reflect changed naming: skip -> disable
Simplify test suite to comply with postgres12

* Update tests to reflect 0.3 breaking changes

* prettied

Co-authored-by: Jannik <jannik@jannikmewes.de>
2022-09-19 21:22:57 +05:00
Gabriel Kim
83f7b88387
fix: malformed query when selecting deeply nested embedded entities (#9273)
Update `SelectQueryBuilder.buildSelect` method to correctly build the property path for deeply nested embedded entities
2022-09-19 21:14:03 +05:00
Umed Khudoiberdiev
f943e61be9 removed only test 2022-09-19 18:05:30 +05:00
janzipek
a917d657fb
fix: Update RelationIdLoader to use DriverUtils.getAlias (#9380)
Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database.

Closes: #9379

Co-authored-by: Jan Zípek <jan@zipek.cz>
2022-09-19 18:04:30 +05:00
AlexMesser
cc639610dc
fix: add missing support for primaryKeyConstraintName property in EntitySchema
adds missing support for primaryKeyConstraintName property in EntitySchema definition;
adds tests for another custom constraint names in EntitySchema definition;
2022-08-30 21:44:48 +05:00
Taylor Hakes
68e8f22894
feat: add setOnLocked for SKIP LOCKED and NOWAIT (#9317) 2022-08-26 00:24:16 +05:00
Ahmed Osama Ibrahim
340ab67b10
feat: add fake migrations running and reverting (#8976)
* feat: add fake migrations running and reverting

Added a cli option to fake-run or fake-revert a migration, adding to the
executed migrations table, but not actually running it. This feature is
useful for when migrations are added after the fact or for
interoperability between applications which are desired to each keep
a consistent migration history

Closes: #6195

* changed enabled drivers in test

* added docs to the property

* fixed lint issue

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2022-08-25 20:17:28 +05:00
Ahmed Osama Ibrahim
5e5abbd148
fix: resolve FindOptionsOrder.nulls to allow FIRST/LAST in uppercase (#8978)
* fix: resolve FindOptionsOrder.nulls issue to accept FIRST/LAST in uppercase

Closes #8970

* fixed failing test

Co-authored-by: Alex Messer <dmzt08@gmail.com>
2022-08-25 19:50:11 +05:00
Stefan Aebischer
72728f155d
fix: allow where IsNull for ManyToOne relations (#9031)
* fix: allow where IsNull for ManyToOne relations

Closes: #8890

* fix direct FindOperator queries on MTO relation

* fix: allow FindOperator queries on OTO owner column

* chore: prettier formating
2022-08-25 19:07:06 +05:00
Joren Vandeweyer
88d0ced812
fix: QueryBuilder update handles Date objects wrong on a ManyToOne relationship (#8748)
* fixes #8747

* apply fix again

* added test for issue 8747

* format

* remove .only

* only use postgres driver

* fixed test

* removed createDateColumn

* sqlite does not support timestamp type

* fix typo

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>
2022-08-25 19:01:40 +05:00
Philip Thrasher
b8d04dc3f9
fix: sqlite temporary tables now honor withoutRowid (#8431)
* fix: sqlite temporary tables now honor withoutRowid

Closes: #8430

* merge master

* fixed `withoutRowid` on table recreation;
added test;

Co-authored-by: Thrasher <thrasher@grayshift.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>
2022-08-25 18:29:16 +05:00
John
c4f46506d8
fix: change postgres driver version checking query (#9319)
* fix #9318

fix: change postgres driver version checking query

Change the postgres `SHOW server_version` query to use `SELECT version()` which adds compatibility with AWS Redshift database

Closes: #9318

* git-issue 9318: remove describe from only in test

* fix-9318: prettier format test
2022-08-25 17:40:12 +05:00
Umed Khudoiberdiev
7198a7a732
Revert "feat: add array parameter on groupBy (#9243)" (#9320)
This reverts commit 77866d85d20991930f55000cd5d4e340c68930b4.
2022-08-24 22:49:15 +05:00
Frank Chan
dadb658c59
feat: add support for non-generated columns with uuid_generate_v4() default (#9065)
* fix: support postgres column with varchar datatype and uuid_generate_v4() default

Closes: #9063

* added test

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2022-08-24 22:02:21 +05:00
Dmitry Guketlev
f045536f24
fix: entity manager remove using entity schemas (#9221)
Currently the entity manager remove method does not recognize the first param if it is an entity schema.
2022-08-24 21:47:19 +05:00
Zach Tindall
72a0147f31
fix: update date utils to parse year correctly for years 1-999 (#9236)
* fix: update date utils to parse year correctly for years 1-999

Closes: #9230

* fix: commit change to date utils

* fix: default total length to 2
2022-08-24 21:42:00 +05:00
Kevin KONRAD
14dfadbde9
fix: handle inherited relations insert order (#9242)
Take inheritance into consideration when sorting insert commands

Closes: #9241

Co-authored-by: Kevin KONRAD <ext.kevin.konrad@reseau.sncf.fr>
2022-08-24 21:38:01 +05:00
MURAKAMI Masahiko
e51991076d
fix: don't use temporary table name to create foreign key, unique, check constraint with SQLite (#9185)
* fix: don't use temporary table name to create foreign key, unique, check constraint with SQLite

In migration steps, finally temporary table name is renamed to original table name. these constraints name should be created from original table name not temporary table name.

Closes: #9176

* style: remove unnecessary comment
2022-08-24 21:37:45 +05:00
wirekang
77866d85d2
feat: add array parameter on groupBy (#9243)
* feat: add array parameter on groupBy

* docs: add groupBy(string[])
2022-08-24 21:36:24 +05:00
Hyunji Song
e49d0c8740
fix: find query mongodb properly with @DeleteDateColumn() (#9262)
* fix: use existing query and filter deleted data

* test: add mongo-repository query test with DeleteDateColumn

* style: lint MongoEntityManager

* fix: not override $or with query.$or

* test: not override query.$or
2022-08-24 21:11:07 +05:00
Dmitry Zotov
90ce28591b fixed failing test 2022-08-24 21:09:16 +05:00
Erwin Kraan
de8aaac54c
fix: dropIndex now works when providing a tableIndex without name (#8937) 2022-08-24 20:31:06 +05:00
Umed Khudoiberdiev
48e64e6973 removed logging 2022-08-24 20:01:37 +05:00