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

default enum value when creating migrations #9685

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

KhaledSMQ
Copy link
Contributor

Description of change

This PR is to get the default enum value when creating migrations correctly.
Closes: #9684
expected enum default value UNPAID from 'UNPAID'::module-payment_order_entity_enum constraint, but the return was incorrect 'UNPAID'-payment_order_entity_enum"

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 #9684
  • 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

@AlexMesser AlexMesser merged commit b3b0c11 into typeorm:master Feb 7, 2023
@AlexMesser
Copy link
Collaborator

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 <dmzt08@gmail.com>

* 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] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
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 <pleerock.me@gmail.com>

* 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 <pavel@loanbase.com>

* 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 <adrian.burlacu@live.com>

* 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 <mortz.prk@gmail.com>

* 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 <brutkowski@tilt.app>
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>

* 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 <pleerock.me@gmail.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>

* 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 <55386067+leo-jnesis@users.noreply.github.com>

Co-authored-by: AlexMesser <dmzt08@gmail.com>
Co-authored-by: leo-jnesis <55386067+leo-jnesis@users.noreply.github.com>

* 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 <1468709606@qq.com>

* 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 <adrian.parry@reign.cl>

* 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 <James.Jurach@apiture.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>

* 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 <dmzt08@gmail.com>

* 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 <dmzt08@gmail.com>

* 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] <support@github.com>
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 <dmzt08@gmail.com>

* 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 <pleerock.me@gmail.com>

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

Closes: typeorm#9690

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>

* 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: Игорь Сары <isary@MacBook-Pro-Igor.local>
Co-authored-by: dzvyagin <dzvyagin@team.amocrm.com>

* 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 <stefi@sprintingsoftware.com>

* 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 <matheusantiquera@finchsolucoes.com.br>

* 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 <dmzt08@gmail.com>

* 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 <christian@wunderbit.de>

* 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] <support@github.com>
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 <ke@sbs.co.at>
Co-authored-by: Alex Messer <dmzt08@gmail.com>

* 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 <ke@sbs.co.at>

* 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 <dmitriy.b@tracktica.com>

* 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 <pleerock.me@gmail.com>

* 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 <pleerock.me@gmail.com>

* 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 <ke@sbs.co.at>

* 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 <pleerock.me@gmail.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>

* 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 <matheusantiquera@finchsolucoes.com.br>
Co-authored-by: tgrassl <grassl.timon@gmail.com>
Co-authored-by: Matheus Melo Antiquera <matheus.melo.a@hotmail.com>

* 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 <dmzt08@gmail.com>

* 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 <ru@shuffle.com>

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

Co-authored-by: Lucian Mocanu <lucian.mocanu@nexontis.com>

* fixed compiler error

* version bump

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

* fixed: issue typeorm#8860

* example looks rough

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>

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

Co-authored-by: afournier <afournier@solocal.com>

* 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 <37216082+oxyrinchus@users.noreply.github.com>

* 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 <pleerock.me@gmail.com>

* 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 <pleerock.me@gmail.com>

* 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 <jrybarczyk@exclusiveresorts.com>

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

* added instanceName to options

* run prettier

---------

Co-authored-by: Jens Horch <horch@hector.de>

* 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 <ke@sbs.co.at>

* 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 <pleerock.me@gmail.com>

* 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 <pleerock.me@gmail.com>

* 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] <support@github.com>
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: smile1sky <82568280+smile-sky20@users.noreply.github.com>
Co-authored-by: Bikram Suwal <veekramsuwal@gmail.com>
Co-authored-by: Dominic Ruggiero <dominic@userexe.me>
Co-authored-by: AlexMesser <dmzt08@gmail.com>
Co-authored-by: Danny Koppenhagen <mail@k9n.dev>
Co-authored-by: Oskar Jaskólski <oskarrro90@gmail.com>
Co-authored-by: Barak Shelef <107487965+barakshelef-oasis@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnaud de Mouhy <1552768+dehy@users.noreply.github.com>
Co-authored-by: Sakura <54829481+Yuuki-Sakura@users.noreply.github.com>
Co-authored-by: Charlton Austin <charlton.austin@gmail.com>
Co-authored-by: Jeffyter Saraiva <35247554+iJhefe@users.noreply.github.com>
Co-authored-by: Patrick Gallagher <pfgallagher@users.noreply.github.com>
Co-authored-by: Coroliov Oleg <1880059+ruscon@users.noreply.github.com>
Co-authored-by: Gonzalo Rodulfo Martínez <23481808+rodzalo@users.noreply.github.com>
Co-authored-by: Charlély Delgrange <charlely.delgrange@gmail.com>
Co-authored-by: Pavel Petrik <redwert@users.noreply.github.com>
Co-authored-by: Pavel <pavel@loanbase.com>
Co-authored-by: kz-d <116164465+kz-d@users.noreply.github.com>
Co-authored-by: Adrian Burlacu <63519230+adrian-burlacu-software@users.noreply.github.com>
Co-authored-by: Adrian Burlacu <adrian.burlacu@live.com>
Co-authored-by: Gentilhomme <gentilhomme.thomas@gmail.com>
Co-authored-by: 4l3ss <2623600+4l3ss@users.noreply.github.com>
Co-authored-by: Dan Manastireanu <498419+danmana@users.noreply.github.com>
Co-authored-by: userUndefined ✌️ <80859038+thalles-victor@users.noreply.github.com>
Co-authored-by: Nedim Arabacı <nedimarabaci@gmail.com>
Co-authored-by: Michael Wolz <michaelwolz93@gmail.com>
Co-authored-by: Morteza PRK <mortezaPRK@users.noreply.github.com>
Co-authored-by: mortzprk <mortz.prk@gmail.com>
Co-authored-by: Bartłomiej Rutkowski <b.rutkowski94@gmail.com>
Co-authored-by: Bartlomiej Rutkowski <brutkowski@tilt.app>
Co-authored-by: Derek Bonner <deekthesqueak@users.noreply.github.com>
Co-authored-by: Tim Beyer <tim.beyer@gmail.com>
Co-authored-by: Kadir <kadiraciktan@gmail.com>
Co-authored-by: leo-jnesis <55386067+leo-jnesis@users.noreply.github.com>
Co-authored-by: Saad A. Bazaz <saadbazaz@hotmail.com>
Co-authored-by: r-shirasu <82349387+r-shirasu@users.noreply.github.com>
Co-authored-by: Mahmoud Almontasser <almontasser@users.noreply.github.com>
Co-authored-by: JesseNeon <62482001+JesseAyegba@users.noreply.github.com>
Co-authored-by: ayuvlasenko <77232221+ayuvlasenko@users.noreply.github.com>
Co-authored-by: sinkhaha <1468709106@qq.com>
Co-authored-by: sinkhaha <1468709606@qq.com>
Co-authored-by: Adrian Parry <44247645+subparry@users.noreply.github.com>
Co-authored-by: Adrian Parry <adrian.parry@reign.cl>
Co-authored-by: James Jurach <james.jurach@gmail.com>
Co-authored-by: James Jurach <James.Jurach@apiture.com>
Co-authored-by: Sho Ogawa <60885375+linus-sh@users.noreply.github.com>
Co-authored-by: Mattias Fjellvang <simplenotezy@users.noreply.github.com>
Co-authored-by: summer-boythink <57977288+summer-boythink@users.noreply.github.com>
Co-authored-by: 변경연 <39257313+eric-byun@users.noreply.github.com>
Co-authored-by: Filip Wróbel <17615126+f-wrobel@users.noreply.github.com>
Co-authored-by: Lukas Spiss <35728419+Spissable@users.noreply.github.com>
Co-authored-by: Pavel Kolpakov <kolpakov-p@yandex.ru>
Co-authored-by: Zeeshan Haider Khan <50953718+zeeshanhaiderkhan@users.noreply.github.com>
Co-authored-by: Josh Heng <josh@joshheng.co.uk>
Co-authored-by: Vítor L. Brasil <97890530+vitorlbrasil@users.noreply.github.com>
Co-authored-by: Dev Aggarwal <22045791+aggarwaldev@users.noreply.github.com>
Co-authored-by: Kilian Finger <hey@kilianfinger.com>
Co-authored-by: Vista1nik <vista1nik@gmail.com>
Co-authored-by: Toshinori Tsugita <tsugita.dev@gmail.com>
Co-authored-by: PronDmytro <67123804+PronDmytro@users.noreply.github.com>
Co-authored-by: ISary-ge <67458138+ISary-ge@users.noreply.github.com>
Co-authored-by: Игорь Сары <isary@MacBook-Pro-Igor.local>
Co-authored-by: dzvyagin <dzvyagin@team.amocrm.com>
Co-authored-by: StefanZivkovic <44195291+StefanZivkovic@users.noreply.github.com>
Co-authored-by: Stefan <stefi@sprintingsoftware.com>
Co-authored-by: Aritz <6377040+xtremebiker@users.noreply.github.com>
Co-authored-by: Khaled Sameer <khaled.smq@hotmail.com>
Co-authored-by: Matheus Melo Antiquera <33763956+MatheusMeloAntiquera@users.noreply.github.com>
Co-authored-by: Matheus Melo Antiquera <matheusantiquera@finchsolucoes.com.br>
Co-authored-by: ZBAGI <zbagi@poczta.fm>
Co-authored-by: Christian Forgács <christian@forgacs.me>
Co-authored-by: Christian Forgács <christian@wunderbit.de>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <netroy@users.noreply.github.com>
Co-authored-by: 0x269 <33447608+truemogician@users.noreply.github.com>
Co-authored-by: JT Smith <jt@plainblack.com>
Co-authored-by: Ihor Levchenko <ifree92@gmail.com>
Co-authored-by: Peter Hostačný <hostacny.peter@gmail.com>
Co-authored-by: jdgjsag67251 <88368191+jdgjsag67251@users.noreply.github.com>
Co-authored-by: ertl <klaus.ertl1@gmail.com>
Co-authored-by: ke <ke@sbs.co.at>
Co-authored-by: Dylan Seago <dylanseago@users.noreply.github.com>
Co-authored-by: Philipp Dyck <pdyck@users.noreply.github.com>
Co-authored-by: Leon Miller-Out <leon@singlebrook.com>
Co-authored-by: GP4cK <gautier.bayzelon@gmail.com>
Co-authored-by: Daniel Huth <4455258+Agreon@users.noreply.github.com>
Co-authored-by: dmytroboiko <dmytro@pipernet.com>
Co-authored-by: Dmytro Boiko <dmitriy.b@tracktica.com>
Co-authored-by: Alexander Kraev <98308330+alexander-kraev-snyk@users.noreply.github.com>
Co-authored-by: Gabriel Kim <68445851+gabrielkim13@users.noreply.github.com>
Co-authored-by: Joe Mizzi <themizzi@me.com>
Co-authored-by: Nguyen Ba Hung <bahung1221@gmail.com>
Co-authored-by: sinopsysHK <sinofwd@gmail.com>
Co-authored-by: acuthbert <acuthbert@gcdtech.com>
Co-authored-by: Jose Toscano <42146866+JoseCToscano@users.noreply.github.com>
Co-authored-by: mptr <54647612+mptr@users.noreply.github.com>
Co-authored-by: tgrassl <grassl.timon@gmail.com>
Co-authored-by: Matheus Melo Antiquera <matheus.melo.a@hotmail.com>
Co-authored-by: Alankarsharma <alankar.sharma005@gmail.com>
Co-authored-by: Stafford Williams <staff0rd@users.noreply.github.com>
Co-authored-by: Bengt Weiße <bengtler@gmail.com>
Co-authored-by: ☃ Elliot Shepherd <elliot@jarofworms.com>
Co-authored-by: RustySol <93598467+RustySol@users.noreply.github.com>
Co-authored-by: ru.c <ru@shuffle.com>
Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
Co-authored-by: Lucian Mocanu <lucian.mocanu@nexontis.com>
Co-authored-by: Ezekiel Adetoro <39957559+adetorodev@users.noreply.github.com>
Co-authored-by: Alexis Fournier <75622873+a-fournier@users.noreply.github.com>
Co-authored-by: afournier <afournier@solocal.com>
Co-authored-by: Jo YoHan <37216082+Slowhigh@users.noreply.github.com>
Co-authored-by: Jo YoHan <37216082+oxyrinchus@users.noreply.github.com>
Co-authored-by: spotykatch <andrey.dashevskiy@yandex.ru>
Co-authored-by: Eliya Cohen <co.eliya2@gmail.com>
Co-authored-by: smith-xyz <51304449+smith-xyz@users.noreply.github.com>
Co-authored-by: YoungKi Lyu <youngkiu@gmail.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
Co-authored-by: Joe Rybarczyk <95554565+99xtal@users.noreply.github.com>
Co-authored-by: jrybarczyk <jrybarczyk@exclusiveresorts.com>
Co-authored-by: Jens Horch <jenshorch@icloud.com>
Co-authored-by: Jens Horch <horch@hector.de>
Co-authored-by: Sergey Pahuta <siarhei.pakhuta@mapbox.com>
Co-authored-by: tqh177 <42137654+tqh177@users.noreply.github.com>
Co-authored-by: leoojg <leoojg@gmail.com>
Co-authored-by: Felix Gohla <37421906+felix-gohla@users.noreply.github.com>
Co-authored-by: LoneRifle <LoneRifle@users.noreply.github.com>
Co-authored-by: pro100kryto <47232701+pro100kryto@users.noreply.github.com>
Co-authored-by: juliengbt <48599640+juliengbt@users.noreply.github.com>
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.

Incorrect enum default value when table name contains dash character
2 participants