Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: upsert options conflictPaths as Entity keys #9365

Merged
merged 4 commits into from
Dec 3, 2022

Conversation

redwert
Copy link
Contributor

@redwert redwert commented Sep 9, 2022

Description of change

Add checks that conflictPaths in upsert options relate to Entity

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@redwert
Copy link
Contributor Author

redwert commented Sep 9, 2022

`
@entity()
export class Post {
@PrimaryGeneratedColumn()
id: number

@Column()
title: string

}
`

image

@pleerock
Copy link
Member

I understand what you are trying to resolve, but I would avoid merging it because:

  • there are other methods / options that are not keyof Entity and we need to design everything carefully and apply changes everywhere
  • I don't know how currently users are using conflictPaths - do they use it with non-entity columns? If they do, this change is considered as breaking change.

@redwert
Copy link
Contributor Author

redwert commented Sep 15, 2022

reasonable, and what about adding support for the following declaration:
awai tsomeRepository.upsert( {tite;"the title"}, {conflictPaths: {title: true}} )
Add the ability to declare the conflict paths like we declare the relations in find.

@pleerock
Copy link
Member

Yes, if we would have this feature, it definitely needs to be as {conflictPaths: {title: true}} because we need to support columns inside embeds, e.g. { {conflictPaths: { nested: { title : true }}}. But again, this is part of the bigger breaking changes.

@redwert
Copy link
Contributor Author

redwert commented Sep 21, 2022

Please take a look on these changes

@pleerock
Copy link
Member

I can accept it since it looks like doesn't break anything. Keep in mind embeds in entities are not supported by your changes. Later on we'll need to add this feature as well. Please add a test case for your change.

@redwert
Copy link
Contributor Author

redwert commented Sep 26, 2022

I have added the test

@redwert
Copy link
Contributor Author

redwert commented Oct 5, 2022

@pleerock could you please take a look. I have added the test and probably you can merge it

@pleerock pleerock merged commit b282428 into typeorm:master Dec 3, 2022
@pleerock
Copy link
Member

pleerock commented Dec 3, 2022

Thank you for contribution! 🎉

javierdelafuentesales added a commit to streamyard/typeorm that referenced this pull request Jun 30, 2023
* feat: added opaque types support over primitives in find-options (typeorm#9560)

* added opaque types support over primitives in find-options
* removed lock-verify because of its deprecation
* fixing auto type mapping

* docs: improve zh docs (typeorm#9575)

* docs: general grammer (typeorm#9574)

* Github issue templates converted to forms (typeorm#9434)

* Update and rename bug-report.md to bug-report.yml

* Update and rename documentation-issue.md to documentation-issue.yml

* Update and rename feature-request.md to feature-request.yml

* checkboxes

* Update feature-request.yml

* Update feature-request.yml

Co-authored-by: AlexMesser <[email protected]>

* feat: allow peerDependency of better-sqlite3 version 8.x.x (typeorm#9564)

closes typeorm#9563

* docs: removed unnecessary slash in comments (typeorm#9533)

* fix: pass fake flag to undoLastMigration (typeorm#9562)

Closes: typeorm#9561

* build(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (typeorm#9590)

Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: correctly return insertId for react-native (typeorm#9554)

* fix: the mpath is incorrect when the parent of the tree entity is null (typeorm#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

* docs: add in an example for 4526 (typeorm#9538)

* docs: add in an example for 4526

* small fixes

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* feat: "And" operator in FindOptions (typeorm#9489)

Closes typeorm#3113

* fix: left instead of inner join for where or + optional relations (typeorm#9516)

* fix: typings for Repository.extend function (typeorm#9396)

additionally remove duplicated TreeRepository.extend method

* feat: index support for materialized views of PostgreSQL (typeorm#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

* docs: Improve comprehension of update repository API (typeorm#9417)

* Improve comprehension of update repository API

Because the previous doc example was `await repository.update({ firstName: "Timber" }, { firstName: "Rizzrak" })`, I got confused and reversed the **WHERE** condition and the actual **change**.

This change is just a suggestion to avoid that kind of confusion

* Apply the same doc suggestion change to the entity manager update API

* feat: upsert options conflictPaths as Entity keys (typeorm#9365)

* feature: upsert options conflictPaths as Entity keys

* feature: upsert options conflictPaths as object

* feature: upsert options conflictPaths as object

Co-authored-by: Pavel <[email protected]>

* docs: update "migrate:show error code" description (typeorm#9476)

* feat: add id in migrate:show command logging (typeorm#9475)

* feat: add Open DB Flags and URI DB Name in SQLite (typeorm#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 <[email protected]>

* fix: assign isInitialized: true at the end of .initialize() method (typeorm#9455)

* fix: cacheId not used when loading relations with take (typeorm#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

* feat: add parseInt8 option to postgres driver. Closes typeorm#9341 (typeorm#9435)

* feat: add parseInt8 option to postgres driver

* chore: formatting

* Revert "fix: assign isInitialized: true at the end of .initialize() method (typeorm#9455)" (typeorm#9591)

This reverts commit 81fc9a9.

* fix: fixed outdated `init` command (typeorm#9422)

* fix: Updating the samples current version of typeorm.

The cli sample was using the getRepository version in the UserController and in the current versions of the typeorm it was deprecated.
Basically I changed the code to the current version using AppDataSource.

* fix: improving code and fixing bugs

I made several changes to the functions because they had bugs, such as the id being a "string" instead of a "number",
the "userRepository" methods being outdated and checking the code to see if the user exists before doing some executions

* feat: migration:generate successful exit the process with zero code (typeorm#9288)

* fix: disable transactionSupport option for CordovaDriver (typeorm#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

* feat: implement exists query method (typeorm#9303)

Adding `Exists` method to query builder and EntityManager, to check whether a row exists given the conditions

Closes: typeorm#2815

Co-authored-by: mortzprk <[email protected]>

* feat: Add synchronize to @jointable (typeorm#9442)

* feat: Add synchronize option to @jointable

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

Closes typeorm#3443

* removed only

* lint fix

Co-authored-by: Bartlomiej Rutkowski <[email protected]>
Co-authored-by: Umed Khudoiberdiev <[email protected]>
Co-authored-by: Alex Messer <[email protected]>

* lint fix

* feat: allow for partial index conditions for on conflict statments in postgres (typeorm#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 <[email protected]>
Co-authored-by: Alex Messer <[email protected]>

* fixed latest typescript-related issue

* feat: allow per-migration control over transaction behavior (typeorm#9459)

Closes typeorm#7087

* fix : primary constraint name undefined error (typeorm#9576)

* fix : primary constraint name undefined erorr for PostgresQueryRunner.ts

* Update src/driver/postgres/PostgresQueryRunner.ts

Co-authored-by: leo-jnesis <[email protected]>

Co-authored-by: AlexMesser <[email protected]>
Co-authored-by: leo-jnesis <[email protected]>

* version bump

* docs: fix missing ) (typeorm#9629)

* fix: DataSource.setOptions doesn't properly update the database in the drivers (typeorm#9635)

* make sure we update database in the driver if it was dynamically set (via dataSource.setOptions)

* removed validation for database since we definitely shouldn't have it in the constructor, database can be set later on (e.g. datasource.setOptions)

* fix: multiple select queries during db sync in sqlite (typeorm#9639)

* fixed multiple select queries during db sync in sqlite

* docs: correct typo (typeorm#9655)

* docs: correct a typo (typeorm#9651)

* docs: correct typo (typeorm#9643)

* Create SECURITY.md

* fix: allow to pass ObjectLiteral in mongo find where condition (typeorm#9632)

Closes: typeorm#9518

* feat: support busy_timeout param parameter for sqlite (typeorm#9623)

Co-authored-by: sinkhaha <[email protected]>

* fix: materialized hints support for cte (typeorm#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 <[email protected]>

* fix: synchronizing View with schema broken for oracle (typeorm#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 <[email protected]>
Co-authored-by: Alex Messer <[email protected]>

* removed titles from issue templates

* docs: fix some typo in migration document (typeorm#9667)

* feat: support time travel queries, upsert, enums, spatial types in cockroachdb (typeorm#9128)

* feature: adds support for enum type (fixes typeorm#9068)

* temporarily ran package to test on different repo

* playing around - bumped version

* Revert "playing around - bumped version"

This reverts commit 7df4adb.

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

This reverts commit 48f394e.

* 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 typeorm#8532)

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

This reverts commit e00cdb0.

* 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 typeorm#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 <[email protected]>

* refactor: remove a deprecated function (typeorm#9702)

* fix: remove unnecessary .js extension in imports (typeorm#9713)

* fix: remove extension when importing file

* removed unnecessary .js extension in imports

---------

Co-authored-by: Dmitry Zotov <[email protected]>

* chore: add *.iml to .gitignore (typeorm#9707)

* test: Add test to prove that issue typeorm#2331 is resolved (typeorm#9688)

* test: update multiple nested embedded entities (typeorm#9696)

* test: update multiple nested embedded entities

Closes: typeorm#1200

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

Closes: typeorm#1200

* test: correct test name for issue 1200

Closes: typeorm#1200

* fix: overriding caching settings when alwaysEnabled is true (typeorm#9731)

* 9023-2 Fix cache overriding option

* 9023-2 Fix format

* docs: update many-to-many-relations.md (typeorm#9736)

* build(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (typeorm#9758)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: Fix grammar error in no migrations found log (typeorm#9754)

* docs: Fix grammar error in the first paragraph. (typeorm#9759)

docs: Fix grammar (verbal agreement) error in the first paragraph.

* feat: allow mysql2 v3 as peerDependency (typeorm#9747)

Closes typeorm#9714

* fix: make sure "require" is defined in the environment

* fix: redundant Unique constraint on primary join column in Postgres (typeorm#9677)

* test: one migration for PrimaryColumn and JoinColumn in pg

* fix: stop postgres from creating unique on PrimaryColumn with JoinColumn

* fix: resolve issue with "simple-enum" synchronization in SQLite (typeorm#9716)

* fix: resolve issue with "simple-enum" in sqlite

Closes: typeorm#9715

* trying to re-trigger CircleCI tests

---------

Co-authored-by: Dmitry Zotov <[email protected]>

* fix: improved `FindOptionsWhere` behavior with union types (typeorm#9607)

* test: add test that where condition can accepts LessThan with Union

* fix: allow FindOptionsWhere to accept LessThan with Union

* added comment and simplified the type

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* fix: sql expression when `where` parameter is empty array (typeorm#9691)

Closes: typeorm#9690

Co-authored-by: Dmitry Zotov <[email protected]>

* feat: naming strategy for legacy Oracle (typeorm#9703)

* feat: naming strategy for legacy Oracle

This feature is LegacyOracleNamingStrategy which can be used to handle Oracle error ORA-00972.

* feat: naming strategy for legacy Oracle

This feature is LegacyOracleNamingStrategy which can be used to handle Oracle error ORA-00972.

* feat: add find operator json contains (typeorm#9665)

* feature: add find operator json contains

* add test

---------

Co-authored-by: Игорь Сары <[email protected]>
Co-authored-by: dzvyagin <[email protected]>

* docs: update cli related docs (typeorm#9659)

- remove cli.entitiesDir description
- remove cli.subscribersDir description
- remove cli from Data Source Options example
- extend migration:run examples with -- -d path-to-datasource-config
- extend migration:revert examples with -- -d path-to-datasource-config
- extend migration:show examples with -- -d path-to-datasource-config
- extend migration:create examples with path-to-migrations-dir/migrationName

Co-authored-by: Stefan <[email protected]>

* feat: support enableWal for the better-sqlite3 driver (typeorm#9619)

* fixed wrong callback definition in tests

* fix: Incorrect enum default value when table name contains dash character (typeorm#9685)

* fix: get enum default value

* chore: format

* fix: add support for mongodb v4 (typeorm#9450)

* fix: add support for mongodb driver v4

This new fix allow support to mongodb driver v4

Closes: typeorm#7907

* fix: add support for mongodb driver v4
This new fix allow support to mongodb driver v4

Closes: typeorm#7907

---------

Co-authored-by: Matheus Melo Antiquera <[email protected]>

* Revert "fix: add support for mongodb v4 (typeorm#9450)" (typeorm#9762)

This reverts commit 8150525.

* fix: incorrect sorting of entities with multi-inheritances (typeorm#9406)

* Fixed sorting of entities with multi-inheritances

* prettier

* added test case

---------

Co-authored-by: Alex Messer <[email protected]>

* removed unnecessary .js extension in imports

* refactor: use abstract logger to reduce duplicate code (typeorm#9751)

* feat(platform-tools): add more logging functions

* refactor(logger): add `AbstractLogger` to reduce duplicate code

---------

Co-authored-by: Christian Forgács <[email protected]>

* feat: update mssql dependency and other dependencies as well (typeorm#9763)

* updating dependencies

* fixing circleci config

* reverting mongodb version back

* increasing cli commands test timeout

* feat: support for SQL aggregate functions SUM, AVG, MIN, and MAX to the Repository API (typeorm#9737)

* feat: Add support for SQL aggregate functions SUM, AVG, MIN, and MAX to the Repository API

* rename field name to make tests work in oracle

* fix the comments

* update the docs

* escape column name

* address PR comment

* format the code

* version bump

* fix: react-native doesn't properly work in ESM projects because of circular dependency (typeorm#9765)

* fix: use forward slashes when normalizing path (typeorm#9768)

Fixes typeorm#9766

* docs: documented getCount() method (typeorm#9847)

* documented getCount()

getCount() is currently only mentioned in the documentation once, and you're never shown how to use it. This patch adds a little documentation for getCount()

* clarification

* docs: update relations-faq (typeorm#9879)

Proposed a better safe-type workaround for circular dependencies.

* docs: update many-to-many-relations.md (typeorm#9861)

Fixing typescript code.

* docs: added a documentation section on debugging query builder (typeorm#9846)

* Added a section on debugging query builder

It covers using getQuery() and getQueryAndParameters() which are both useful when trying to figure out why your query isn't doing what you might expect it should do.

* forgot await

* fix typo

* refactor: remove date-fns package (typeorm#9634)

* refactor: remove date-fns

Since TypeORM only uses one function from the date-fns library
it is unnecessary to install this large package.

* refactor: add DateUtils.parseDateAsISO

* refactor: reintroduced comment

* build(deps): bump jsonwebtoken and mssql (typeorm#9700)

Bumps [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) to 9.0.0 and updates ancestor dependency [mssql](https://github.com/tediousjs/node-mssql). These dependencies need to be updated together.


Updates `jsonwebtoken` from 8.5.1 to 9.0.0
- [Release notes](https://github.com/auth0/node-jsonwebtoken/releases)
- [Changelog](https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md)
- [Commits](auth0/node-jsonwebtoken@v8.5.1...v9.0.0)

Updates `mssql` from 7.3.0 to 9.0.1
- [Release notes](https://github.com/tediousjs/node-mssql/releases)
- [Changelog](https://github.com/tediousjs/node-mssql/blob/master/CHANGELOG.txt)
- [Commits](tediousjs/node-mssql@v7.3.0...v9.0.1)

---
updated-dependencies:
- dependency-name: jsonwebtoken
  dependency-type: indirect
- dependency-name: mssql
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: resolve issues for mssql migration when simple-enum was changed

* fix: resolve issues for mssql migration when simple-enum was changed

- Changes are now detected
- Incorrect update Statement was split into a DROP CONSTRAINT and ADD CONSTRAINT Statement

Closes: typeorm#7785 typeorm#9457

* fix: resolve issues for mssql migration when simple-enum was changed

- Changes are now detected
- Incorrect update Statement was split into a DROP CONSTRAINT and ADD CONSTRAINT Statement

Closes: typeorm#7785 typeorm#9457

* code refactoring;
changed `enumName` usage to generated name;
improvements in test;

---------

Co-authored-by: ke <[email protected]>
Co-authored-by: Alex Messer <[email protected]>

* fix: resolves issue with mssql column recreation (typeorm#9773)

* fix: resolves issue with mssql column recreation when length max is in lower case

Closes: typeorm#9399

* removed redundant question mark

---------

Co-authored-by: ke <[email protected]>

* feat: allow type FindOptionsOrderValue for order by object property (typeorm#9895) (typeorm#9896)

When using an Entity column transformer for an object type, the underlying database column may be
sortable, despite the static TypeScript type being an object. The `FindOptionsOrder` typing
should allow sorting on that object property and not require further nesting.

Fixes issue typeorm#9895.

* fixing failing test

* feat: Broadcast identifier for removed related entities  (typeorm#9913)

* Initial commit

* Pending changes exported from your codespace

* Revert changes

* Fix format

* test: when calling AVG on an integer column, MS SQL Server returns an int. (typeorm#9784)

In this case, 50 instead of 50.5. Apparently the ANSI standard for SQL
is silent on this issue, so either behavior should be considered
acceptable.

* fix: loading tables with fk in sqlite query runner (typeorm#9875)

Closes: typeorm#9266

* fix: improve EntityNotFound error message in QueryBuilder.findOneOrFail (typeorm#9872)

* fix: EntityNotFound error message in QueryBuilder.findOneOrFail

* change test

* change test

* change test

* fix: proper default value on generating migration when default value is a function calling [Postgres] (typeorm#9830)

Co-authored-by: Dmytro Boiko <[email protected]>

* docs: update migrations docs (typeorm#9828)

* feat: add support for STI on EntitySchema (typeorm#9834)

* feat: add support for STI on EntitySchema

Closes: typeorm#9833

* fix: run prettier

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* fix: use object create if entity skip constructor is set (typeorm#9831)

* feat: add support for json datatype for sqlite (typeorm#9744)

* fix: prevent foreign key support during migration batch under sqlite (typeorm#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: typeorm#9770

* Update MigrationExecutor.ts

* Update command.ts

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* fix: transform values for FindOperators typeorm#9381 (typeorm#9777)

* fix: transform values for FindOperators

Closes: typeorm#9381

* refactor: simplify correction

do not transform value, when it is a FindOperator

Closes: typeorm#9381

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

Closes: typeorm#9381 typeorm#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 <[email protected]>

* feat: leftJoinAndMapOne and innerJoinAndMapOne map result to entity (typeorm#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 <[email protected]>
Co-authored-by: Dmitry Zotov <[email protected]>

* fix: handles "query" relation loading strategy for TreeRepositories (typeorm#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: typeorm#9673

* fix: firstCapital=true not working in camelCase() function

* feat: QueryBuilder performance optimizations (typeorm#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

* version bump

* fix: wrong dependency version in init command

* fix: drop xml & yml connection option support (typeorm#9930)

* version bump

* added package lock

* ci: wait if oracle db is enabled in test suite (typeorm#9946)

* test: cli init with local typeorm package (typeorm#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

* feat: support for the latest mongodb v5 (typeorm#9925)

* fix: add support for mongodb driver v5

This new fix allow support to mongodb driver v5

Closes: typeorm#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: typeorm#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 <[email protected]>
Co-authored-by: tgrassl <[email protected]>
Co-authored-by: Matheus Melo Antiquera <[email protected]>

* fix: SelectQueryBuilder builds incorrectly escaped alias in Oracle when used on entity with composite key (typeorm#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 <[email protected]>

* chore: better console.log (typeorm#9924)

* refactor: combine sqlite json and simple-json handling (typeorm#9937)

* docs: wrong documentation on QueryBuilder.getCount() (typeorm#9935)

* fix: make cache optional fields optional (typeorm#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 <[email protected]>

* fix: prevent unique index identical to primary key (all sql dialects) (typeorm#9940)

Co-authored-by: Lucian Mocanu <[email protected]>

* fixed compiler error

* version bump

* docs: issue typeorm#8860 (typeorm#9951)

* fixed: issue typeorm#8860

* example looks rough

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* fix: add directConnection options to MongoDB connection (typeorm#9955)

Co-authored-by: afournier <[email protected]>

* docs: update entity-manager-api.md (typeorm#9956)

typo:
const timber = await manager.findOne(User, { firstName: "Timber" })   →   const timber = await manager.findOneBy(User, { firstName: "Timber" })

Co-authored-by: Jo YoHan <[email protected]>

* fix: resolve duplicate subscriber updated columns (typeorm#9958)

Closes: typeorm#9948

* fix: select + addOrderBy broke in 0.3.14 (typeorm#9961)

* added test for typeorm#9960
* fixing the issue
* limiting only to postgres because of NULLS FIRST syntax
* lint

* refactor: query methods should accept generic for return type (typeorm#9957)

* query should accept generics

* Update DataSource.ts

* feat: mariadb uuid inet4 inet6 column data type support (typeorm#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

* fix: mongodb typings breaks the browser version (typeorm#9962)

* fix: exclude mongodb typings from browser

Closes: typeorm#9959

fix: delete unnessecary dummy file

* another fix for bson typings problem in browser

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* revert: "refactor: remove date-fns package (typeorm#9634)"

This reverts commit 1fcd9f3

* fix: allow json as alias for longtext mariadb (typeorm#10018)

* fix: express option bug in init command (typeorm#10022)

* Fix express option bug in init command

* fixed esm support in command

* fix linter

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* fix: RelationIdLoader has access to queryPlanner when wrapped in transaction (typeorm#9990)

fix issue - createQueryBuilder in repository loses queryplanner when wrapped in txn upsteam until RelationIdLoader

Closes: typeorm#9988

* fix: add `trustServerCertificate` option to `SqlServerConnectionOptions` (typeorm#9985)

* fix: add missing 'trustServerCertificate' option to SqlServerConnectionOptions interface

Closes: typeorm#8093

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

* fix: consistency between jsdoc and docs

---------

Co-authored-by: jrybarczyk <[email protected]>

* fix: added instanceName to options (typeorm#9968)

* added instanceName to options

* run prettier

---------

Co-authored-by: Jens Horch <[email protected]>

* fix: for running cli-ts-node-esm use exit code from child process (typeorm#10030)

Use child process exit code in parent process to properly indicate that child process (migration running) fails

Closes: typeorm#10029

* fix: add onDelete option validation for oracle (typeorm#9786)

* fix: add onDelete option validation for oracle

Closes: typeorm#9189

* refactor: move fk validation logic to EntityMetadataValidator.ts

* fix: skip assertion for other databases

* fix: styles

---------

Co-authored-by: ke <[email protected]>

* fix: convert the join table ID to the referenceColumn ID type (typeorm#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

* fix: correct encode mongodb auth credentials (typeorm#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: typeorm#9885

* we need to close connections at the end

* fixed js issue

* adjust import statement

* style: run prettier

---------

Co-authored-by: Umed Khudoiberdiev <[email protected]>

* fix: create correct children during cascade saving entities with STI (typeorm#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: typeorm#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: typeorm#7758

* test: check STI type setting discriminator manually

Related to: typeorm#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: typeorm#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: typeorm#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: typeorm#7758

* fix: support More/LessThanOrEqual in relations  (typeorm#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 <[email protected]>

* fix: added transaction retry logic in cockroachdb (typeorm#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

* version bump

* test: fix test from typeorm#9034 with STI for Oracle (typeorm#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 typeorm#9786.

* fix: add missing await (typeorm#10084)

* chore: use new CircleCI convenience images (typeorm#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 typeorm#10100

* fix: typeorm#10040 TypeORM synchronize database even if it is up to date (typeorm#10041)

* test: typeorm#10040 TypeORM synchronize database even if it is up to date

* formating

* fix: TypeORM synchronize database even if it is up to date typeorm#10040

* feat: Added back fork spanner changes

* fix lock version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Umed Khudoiberdiev <[email protected]>
Co-authored-by: smile1sky <[email protected]>
Co-authored-by: Bikram Suwal <[email protected]>
Co-authored-by: Dominic Ruggiero <[email protected]>
Co-authored-by: AlexMesser <[email protected]>
Co-authored-by: Danny Koppenhagen <[email protected]>
Co-authored-by: Oskar Jaskólski <[email protected]>
Co-authored-by: Barak Shelef <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnaud de Mouhy <[email protected]>
Co-authored-by: Sakura <[email protected]>
Co-authored-by: Charlton Austin <[email protected]>
Co-authored-by: Jeffyter Saraiva <[email protected]>
Co-authored-by: Patrick Gallagher <[email protected]>
Co-authored-by: Coroliov Oleg <[email protected]>
Co-authored-by: Gonzalo Rodulfo Martínez <[email protected]>
Co-authored-by: Charlély Delgrange <[email protected]>
Co-authored-by: Pavel Petrik <[email protected]>
Co-authored-by: Pavel <[email protected]>
Co-authored-by: kz-d <[email protected]>
Co-authored-by: Adrian Burlacu <[email protected]>
Co-authored-by: Adrian Burlacu <[email protected]>
Co-authored-by: Gentilhomme <[email protected]>
Co-authored-by: 4l3ss <[email protected]>
Co-authored-by: Dan Manastireanu <[email protected]>
Co-authored-by: userUndefined ✌️ <[email protected]>
Co-authored-by: Nedim Arabacı <[email protected]>
Co-authored-by: Michael Wolz <[email protected]>
Co-authored-by: Morteza PRK <[email protected]>
Co-authored-by: mortzprk <[email protected]>
Co-authored-by: Bartłomiej Rutkowski <[email protected]>
Co-authored-by: Bartlomiej Rutkowski <[email protected]>
Co-authored-by: Derek Bonner <[email protected]>
Co-authored-by: Tim Beyer <[email protected]>
Co-authored-by: Kadir <[email protected]>
Co-authored-by: leo-jnesis <[email protected]>
Co-authored-by: Saad A. Bazaz <[email protected]>
Co-authored-by: r-shirasu <[email protected]>
Co-authored-by: Mahmoud Almontasser <[email protected]>
Co-authored-by: JesseNeon <[email protected]>
Co-authored-by: ayuvlasenko <[email protected]>
Co-authored-by: sinkhaha <[email protected]>
Co-authored-by: sinkhaha <[email protected]>
Co-authored-by: Adrian Parry <[email protected]>
Co-authored-by: Adrian Parry <[email protected]>
Co-authored-by: James Jurach <[email protected]>
Co-authored-by: James Jurach <[email protected]>
Co-authored-by: Sho Ogawa <[email protected]>
Co-authored-by: Mattias Fjellvang <[email protected]>
Co-authored-by: summer-boythink <[email protected]>
Co-authored-by: 변경연 <[email protected]>
Co-authored-by: Filip Wróbel <[email protected]>
Co-authored-by: Lukas Spiss <[email protected]>
Co-authored-by: Pavel Kolpakov <[email protected]>
Co-authored-by: Zeeshan Haider Khan <[email protected]>
Co-authored-by: Josh Heng <[email protected]>
Co-authored-by: Vítor L. Brasil <[email protected]>
Co-authored-by: Dev Aggarwal <[email protected]>
Co-authored-by: Kilian Finger <[email protected]>
Co-authored-by: Vista1nik <[email protected]>
Co-authored-by: Toshinori Tsugita <[email protected]>
Co-authored-by: PronDmytro <[email protected]>
Co-authored-by: ISary-ge <[email protected]>
Co-authored-by: Игорь Сары <[email protected]>
Co-authored-by: dzvyagin <[email protected]>
Co-authored-by: StefanZivkovic <[email protected]>
Co-authored-by: Stefan <[email protected]>
Co-authored-by: Aritz <[email protected]>
Co-authored-by: Khaled Sameer <[email protected]>
Co-authored-by: Matheus Melo Antiquera <[email protected]>
Co-authored-by: Matheus Melo Antiquera <[email protected]>
Co-authored-by: ZBAGI <[email protected]>
Co-authored-by: Christian Forgács <[email protected]>
Co-authored-by: Christian Forgács <[email protected]>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <[email protected]>
Co-authored-by: 0x269 <[email protected]>
Co-authored-by: JT Smith <[email protected]>
Co-authored-by: Ihor Levchenko <[email protected]>
Co-authored-by: Peter Hostačný <[email protected]>
Co-authored-by: jdgjsag67251 <[email protected]>
Co-authored-by: ertl <[email protected]>
Co-authored-by: ke <[email protected]>
Co-authored-by: Dylan Seago <[email protected]>
Co-authored-by: Philipp Dyck <[email protected]>
Co-authored-by: Leon Miller-Out <[email protected]>
Co-authored-by: GP4cK <[email protected]>
Co-authored-by: Daniel Huth <[email protected]>
Co-authored-by: dmytroboiko <[email protected]>
Co-authored-by: Dmytro Boiko <[email protected]>
Co-authored-by: Alexander Kraev <[email protected]>
Co-authored-by: Gabriel Kim <[email protected]>
Co-authored-by: Joe Mizzi <[email protected]>
Co-authored-by: Nguyen Ba Hung <[email protected]>
Co-authored-by: sinopsysHK <[email protected]>
Co-authored-by: acuthbert <[email protected]>
Co-authored-by: Jose Toscano <[email protected]>
Co-authored-by: mptr <[email protected]>
Co-authored-by: tgrassl <[email protected]>
Co-authored-by: Matheus Melo Antiquera <[email protected]>
Co-authored-by: Alankarsharma <[email protected]>
Co-authored-by: Stafford Williams <[email protected]>
Co-authored-by: Bengt Weiße <[email protected]>
Co-authored-by: ☃ Elliot Shepherd <[email protected]>
Co-authored-by: RustySol <[email protected]>
Co-authored-by: ru.c <[email protected]>
Co-authored-by: Lucian Mocanu <[email protected]>
Co-authored-by: Lucian Mocanu <[email protected]>
Co-authored-by: Ezekiel Adetoro <[email protected]>
Co-authored-by: Alexis Fournier <[email protected]>
Co-authored-by: afournier <[email protected]>
Co-authored-by: Jo YoHan <[email protected]>
Co-authored-by: Jo YoHan <[email protected]>
Co-authored-by: spotykatch <[email protected]>
Co-authored-by: Eliya Cohen <[email protected]>
Co-authored-by: smith-xyz <[email protected]>
Co-authored-by: YoungKi Lyu <[email protected]>
Co-authored-by: Riqwan Thamir <[email protected]>
Co-authored-by: Joe Rybarczyk <[email protected]>
Co-authored-by: jrybarczyk <[email protected]>
Co-authored-by: Jens Horch <[email protected]>
Co-authored-by: Jens Horch <[email protected]>
Co-authored-by: Sergey Pahuta <[email protected]>
Co-authored-by: tqh177 <[email protected]>
Co-authored-by: leoojg <[email protected]>
Co-authored-by: Felix Gohla <[email protected]>
Co-authored-by: LoneRifle <[email protected]>
Co-authored-by: pro100kryto <[email protected]>
Co-authored-by: juliengbt <[email protected]>
@frostbytedata
Copy link

Yea this is a bad change for those of us using embedded entities. It is now no longer possible to specify conflict entity keys in the array for conflictPaths . Here is a simple example below:

class User {
  @Column()
  @IsEmail()
  email: string;

  @Column(() => Profile, {
    prefix: false,
  })
  profile: Profile;
}

class Profile {
  @Column()
  @IsString()
  name: string;

  @Column({
    name: 'profile_avatar',
    nullable: true,
  })
  @IsString()
  avatar: string;
}

In this example, it is impossible (unless I am using it wrong) to specify conflictPath: ['profile_avatar'] for upsert commands. Is there a way around this for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants