739 Commits

Author SHA1 Message Date
Warwick
66acec8c0c
docs: update one-to-one-relations.md (#9456)
One to one documentation is referring to the wrong entity
2022-11-04 15:58:14 +05:00
Karim
ab7ed9c758
docs: fix typo in migrations doc (#9499)
Datasoure ==> Datasource
2022-11-04 15:53:45 +05:00
Rlok
f9a961265e
docs: fix typo of AfterRecover example (#9513) 2022-11-04 15:53:23 +05:00
Collin
d305e5f9ac
feat: new virtual column decorator (#9339)
* feat: implement new calculated decorator

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

Closes #9323

* feat: implement new virtual decorator

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

Closes typeorm#9323

* feat: Implement new virtual decorator

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

Closes typeorm#9323

* feat: implement new virtual decorator

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

Closes typeorm#9323

* feat: implement new virtual decorator

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

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

* rebase test restructure

* rebase orphanedRowAction tests with keyword "disabled"

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

* Update tests to reflect 0.3 breaking changes

* prettied

Co-authored-by: Jannik <jannik@jannikmewes.de>
2022-09-19 21:22:57 +05:00
Morteza PRK
48976c2967
feat: unify Pool max connection size in supported Drivers (#9305)
Added `poolSize` option everywhere to controll pool option

Closes: #3388

Co-authored-by: mortzprk <mortz.prk@gmail.com>
2022-09-19 21:10:02 +05:00
Hannes Van De Vreken
6bc723bba9
refactor: docblock (#9384) 2022-09-19 18:01:02 +05:00
Taylor Hakes
68e8f22894
feat: add setOnLocked for SKIP LOCKED and NOWAIT (#9317) 2022-08-26 00:24:16 +05:00
Ahmed Osama Ibrahim
340ab67b10
feat: add fake migrations running and reverting (#8976)
* feat: add fake migrations running and reverting

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

Closes: #6195

* changed enabled drivers in test

* added docs to the property

* fixed lint issue

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2022-08-25 20:17:28 +05:00
Umed Khudoiberdiev
7198a7a732
Revert "feat: add array parameter on groupBy (#9243)" (#9320)
This reverts commit 77866d85d20991930f55000cd5d4e340c68930b4.
2022-08-24 22:49:15 +05:00
BitDesert
51a0ebe5f2
feat: new mssql option appName (#9213) 2022-08-24 21:56:51 +05:00
Mihai Crisan
8dcd61e0a3
docs: query-runner.md typos (#9228) 2022-08-24 21:44:52 +05:00
Mohamed Akram
d8e5f3b086
docs: correct mssql encrypt default value (#9232) 2022-08-24 21:42:50 +05:00
wirekang
77866d85d2
feat: add array parameter on groupBy (#9243)
* feat: add array parameter on groupBy

* docs: add groupBy(string[])
2022-08-24 21:36:24 +05:00
Lucas Rangel
a98ca8bf97
docs: text on data-source setup section (#9244)
On line 73 have 'three options' to setup, but is actually only two as you can see.
2022-08-24 21:35:13 +05:00
Bogdan Crisan
64674e60a2
docs: fix wrong function used in entity documentation (#9280)
Previously, the documentation said that it's using the `findOne`
function, but it used the `findBy` and `findOneBy` functions. In order
to be coherent, this commit changes all those to `findOneBy`.
2022-08-24 20:15:35 +05:00
Leyla Jähnig
3a533a4223
docs: migration replace Connection with DataSource option (#9315)
* docs: migration replace Connection with DataSource option

* Apply suggestions from code review

Co-authored-by: Leyla Jähnig <leyla.jaehnig@gmx.de>

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2022-08-24 17:06:04 +05:00
Han Moe Htet
0b542225cc
docs: fix method example in EntityManager API (#9170)
Replace manager.getCustomRepository(UserRepository) with manager.withRepository(UserRepository)
2022-07-05 17:06:57 +05:00
Mohamed Akram
2e671386f4
docs: correct useUTC default value (#9161)
Closes: #7047
2022-06-30 15:38:58 +05:00
Julian Pömp
bcdddc32bd
feat: add nativeBinding option to better-sqlite3 driver (#9157)
* feat: add nativeBinding option to better-sqlite3 driver

better-sqlite3 allows to set the `nativeBinding` option since version v7.5.0. It allows to define a custom path for the native api binary `better_sqlite3.node`. This feature is very important for developers who want to create binaries of their node apps for different platforms (e.g. with pkg). [More information](https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#new-databasepath-options=).

* docs: add description about nativeBinding option for better-sqlite3 driver

* refactor: apply prettier, test if nativeBinding is correctly set to better-sqlite3 driver

* refactor: apply prettier

* refactor: replaced describe.only() with describe()
2022-06-29 18:54:17 +05:00
gmmkmtgk
60a79605a7
docs: repository replaced by dataSource.manager.getTreeRepository(Category) (#9144)
Repository should be replaced by dataSource.manager.getTreeRepository(Category)
2022-06-28 17:31:28 +05:00
gmmkmtgk
1b5aa62bed
docs: fix typo in tree docs
At line 167 it should be const a1 = new Category() insted of const a1 = new Category("a1") 
Category do not accept any arguments
2022-06-28 17:29:59 +05:00
Ude Samuel
07f453773c
docs: fixed full path requirement in migration:create command (#9115)
* fixed full path requirement in migration:create command

* Update migrations.md

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2022-06-22 17:55:37 +05:00
apeltop
0659ec3952
docs: correct typos (#9047) 2022-05-30 15:26:09 +05:00
元路
1b4cb00ea2
docs: minor fix in index.md (#9025) 2022-05-23 11:40:32 +05:00
Yusuf Ganiyu
ea176b27d4
docs: update migrations.md (#9022) 2022-05-20 16:14:42 +05:00
Gary Lee
d0ed02d9ce
docs: edit mistypes in the Repository API document (#9012)
docs: edit mistypes in the Repository API document

- Edited mistypes in the example code in findAndCountBy and findOneBy method.
2022-05-20 15:42:16 +05:00
AlexMesser
78df84c732
feat: allow explicitly named primary keys, foreign keys, and indices (#8900)
* feat: add constraintName to JoinColumn

Add a constraintName to JoinColumn decorators to allow specifying foreignKey name.
Use constraintName when building JoinTable entities as well.

Partially solves: #1355

* test: add tests for constraintNames on JoinColumn

* docs: add constraintName documentation to JoinColumn and JoinTable

* test: update snapshot in 5444 test

Add constraintName property with correct variable undefined to snapshot in tests for issue 5444.

* prettier

* added support for custom FK name in Sqlite;
added test;

* removed .only

* fixed FK constraint renaming on table/column rename

* minor fix

* fixed @Unique and @Index constraints renaming on table/column rename

* working on constraint name support for PK

* replaced `constraintName` with `primaryKeyConstraintName` and `foreignKeyConstraintName`

* fixed failing test

* working on constraint name support for PK

* updated docs

Co-authored-by: Matthijs Hatzmann <matthijs.hatzmann@tradecast.eu>
2022-04-29 17:48:40 +05:00
Alessandro Maruccia
8e9b273885
docs: update generate migration docs (#8896) 2022-04-15 20:25:45 +05:00
AlexMesser
62518ae122
feat: Cloud Spanner support (#8730)
* working on Cloud Spanner driver implementation

* working on DDL synchronization

* working on DDL synchronization

* fixed failing test

* working on VIEW implementation

* fixed query parameters

* lint

* added transaction support;
added streaming support;

* fixed column types

* fixes after merge

* prettier

* added support for generated columns

* added escaping for distinct alias

* working on generated columns

* changed failing test

* updated tests for Spanner;
bugfixes;

* updated tests for Spanner;
bugfixes;

* updated tests for Spanner;
bugfixes;

* fixed failing test

* fixed failing test

* fixing failing tests

* fixing failing tests

* fixing failing tests

* added support for typeorm-generated uuid;
fixed caching;

* fixing failing tests

* fixing failing tests

* fixing failing tests

* fixing failing tests

* fixing failing tests

* fixing failing tests

* debugging failing test

* debugging failing test

* fixed bug in @PrimaryColumn decorator

* fixed failing tests

* fixed VIEW functionality;
fixed failing tests;

* updated docs
2022-04-12 17:31:57 +05:00
Uros Smolnik
4687be8b77
feat: add for_key_share ("FOR KEY SHARE") lock mode for postgres driver (#8879)
Adds support for new lock mode `for_key_share` - generating FOR KEY SHARE lock. Postgres specific.

Closes: #8878
2022-04-12 17:30:52 +05:00
Gilad S
1197d1d61c
docs: change bold line to h4 title to improve search index (#8862)
* docs: change bold line to h4 title to improve search index

* Update supported-platforms.md
2022-04-11 21:16:28 +05:00
Marouane
a145f0046d
docs: fix code indentation (#8864)
bad indentation break syntax highlighting.
2022-04-11 21:14:38 +05:00
Rafael Lemos
d18e0eefd5
docs: fix function name (#8840)
The name of the function declared in the repository does not match with the function name used in the examples.
2022-04-02 20:28:37 +05:00
Rafael Lemos
5176a0aff7
docs: missing argument at migration:generate (#8839)
`migration:generate` requires data-source path as argument
2022-04-02 20:27:39 +05:00
Daniel Hritzkiv
68a5c23077
docs: update select-query-builder.md (#8787)
InsertQueryBuilder should not `await`ed when passed into `addCommonTableExpression`
2022-03-23 23:39:18 +05:00
Michał Wadas
7cc1848fd4
feat: support for Common Table Expressions (#8534)
* feat: support for Common Table Expressions

Resolves #1116 #5899

* test: disable test for #4753 if no MySQL is present in ormconfig.json
2022-03-23 18:29:45 +05:00
Gilad S
05fc744469
feat: add typeorm CLI variations that include ts-node (#8776)
* feat: add typeorm CLI variations that include `ts-node`

Add `typeorm-ts-node-commonjs` and `typeorm-ts-node-esm` CLI commands.
This removes the need to manually write `node --require ts-node/register ./node_modules/typeorm/cli.js` or `node --loader ts-node/esm ./node_modules/typeorm/cli.js` in order to use TypeORM CLI without transpiling the code in advance.

* style: formatting
2022-03-22 22:21:14 +05:00
Umed Khudoiberdiev
b53a481430 working on the docs 2022-03-21 22:39:48 +05:00
Umed Khudoiberdiev
ce5973c917 renamed wrong documentation filename 2022-03-21 18:54:45 +05:00
Umed Khudoiberdiev
9f1b8e3425
feat: new array find operators (#8766)
* added new array find operators; delegating how json and jsonb are stored directly to underlying driver (breaking)

* array: true must be explicitly defined for array json/jsonb values; strings being JSON-stringified must be manually escpaed
2022-03-21 17:48:32 +05:00
Umed Khudoiberdiev
d61f857ce9
fix: bugfixes introduced in 0.3.0 (#8764)
* fixes #8762; #8759; #8758; #8757;
2022-03-18 22:37:31 +05:00
Umed Khudoiberdiev
3b8a031ece
0.3.0 (#8616)
* added find options and new option relationLoadStrategy

* find now returns null instead of undefined; removed primary relations support; bugfixing; added some changes and tests from next branch;

* added typename to connection options; added data loader types, lot of deprecations; new es2020 emit by tsc; new custom repositories syntax

* applied lint fixing

* replaced some instanceof checks

* reverting docker compose image versions

* optimizing imports

* reverting back some instanceof checks to prevent compiler errors

* downgrading es compilation version

* docs: remove "primary" from relation options (#8619)

remove ex-line 26 for being deprecated in 0.3.0:
"* `primary: boolean` - Indicates whether this relation's column will be a primary column or not."

* Revert "reverting back some instanceof checks to prevent compiler errors"

This reverts commit 7bf12a39e2297d097aa2a42989afd0e9e4f49bb0.

* Revert "optimizing imports"

This reverts commit 7588ac14e4f1bf1a82e3b7883134b9c2c8ae5f3f.

* Revert "replaced some instanceof checks"

This reverts commit bfa5a2d706f697ed1c1beb38b4455c0d33121e5a.

* fixing few comments

* removing transaction decorators

* this test is invalid - it's not clear why the hell getTreeRepository will throw an error and it's not clear what kind of error its going to throw

* addded mixed list support in connection options

* trying to fix oracle length issue

* lintfix

* removed shorten usages

* added named entity target support to the connection

* fixing entity target support in relation options via entity schema

* debugging oracle issue

* fixed issue with alias not being shortened in many to many alias cases

* some day we'll have a prettier.

* fixing oracle tests

* fixing oracle failing test

* removed "null" support in where expressions; fixed softDelete and restore incorrect usages

* renamed FindConditions to FindOptionsWhere

* version bump

* docs: update loading relation in find method (v 0.3.0) (#8621)

* docs: update relation definition method

Update the method that allows loading a specific relation inside the find method.
This method is found on the one-to-one-relations page.
Change `const users = await userRepository.find({ relations: ["profile"] });` to `const users = await userRepository.find({ relations: {profile: true});`.

* fix formatting

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

* docs: change relations option definition (#8620)

* docs: change relations option definition

change line 139 from 
`const users = await connection.getRepository(User).find({ relations: ["profile", "photos", "videos"] });`
to
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });`
to reflect version 0.3.0 changes

* docs: change relations option definition

Rectified a type on line 139
from:
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });`
to
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true} });`

* formatting

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

* lint

* improved find options types

* fixed types and removed nonnever because it causes circual issue for some reason

* docs: update entitymanager definition (#8623)

* docs: update entitymanager definition

change the "What is EntityManager?" page to be up-to-date with v 0.3.0

1. line 6 changes from
`You can access the entity manager via 'getManager()' or from 'Connection'.`
to 
`You can access the entity manager via DataSource's manager.`

2. the import on `getManager` in line 10 becomes `Manager` that the user have configured beforehand:
`import {getManager} from "typeorm";`
becomes 
`import {Manager} from "./config/DataSource";`

3.change entityManager definition in line 13:
from
`const entityManager = getManager(); // you can also get it via getConnection().manager`
to
`const entityManager = Manager;`

* docs: update entitymanager definition

changed line 10 from: 
`import {Manager} from "./config/DataSource";`
to
`import {DataSource} from "typeorm";`

and changed line 13 and 14 from: 
`const entityManager = Manager;`
`const user = await entityManager.findOne(User, 1);`
to 
`const myDataSource = new DataSource({ /*...*/ });`
`const user = await myDataSource.manager.findOne(User, 1);`

for a simpler way of describing the origin of DataSource and how it works.

* In return type doesn't seem to work in all cases

* feat: mssql v7 support (#8592)

Adds support for v7 of the mssql library as v6 is EOL. This also makes use of the new toReadableStream method on requests to return a native stream where required.

* fix: prefix relation id columns contained in embedded entities (#6977) (#7432)

* fix: prefix relation id columns contained in embedded entities (#6977)

Searches embedded entity columns for relation ID column if relation column
is in embedded entity. If not found, creates new relation ID with embedded
metadata set to match the relation column.

fixes: #2254
fixes: #3132
fixes: #3226
fixes: #6977

* test: prefix subcounters sub-entity with "sub" to fit in 30 character identifier for oracle

Problem introduced with #6981

* fix: find by Date object in sqlite driver (#7538)

* fix: find by Date object in sqlite driver

In sqlite, Date objects are persisted as UtcDatetimeString.
But a Date object parameter was escaped with .toISOString(), making such queries impossible.
This commit aligns both transforms.
This bug does *not* apply to better-sql where you can only bind numbers, strings, bigints, buffers,
and null.
This is breaking for when the user inserted their dates manually as ISO and relied on this old
maltransformation, after this their find()s by Date won't work anymore.

BREAKING CHANGE: Change Date serialization in selects
Closes: #2286

* add failing test

* fix: find by Date object in sqlite driver (with query builder)

Also consider query builder parameter escaping

* test: add test for 3426

Co-authored-by: James Ward <james@notjam.es>

* manually ported changes from #7796

* updated changelog

* fixes after merge

* new findOne syntax

* new find* syntax

* new find* syntax

* lint

* tsc version bump

* tsc version bump and fixed mongodb issues

* moved date fns into non dev deps

* returned oracledb dep into place

* removed lock files

* returned lock files back

* eslint upgrade

* fixing mongodb issue

* fixing mongodb issue

* test: keep junction aliases short (#8637)

Tests a fix for an issue where junction aliases (e.g. in many-to-many relations)
are not unique because they are too long and thus truncated by the driver.

Closes: #8627
Related to: 76cee41dcf1c146d02715c7f48fed33672d28c67

* fixing mongodb issues

* fixing sqlite test

* fixing sqlite test

* fixing sqlite test

* fixing mongodb test

* fixing entity schema tests

* fixing entity schema tests

* merged latest master

* removed driver instanceof checks

* removed function instanceof checks

* removed Object instanceof checks

* removing instanceof checks...

* fixing instanceof checks

* added InstanceChecker to remove remaining instanceof checks

* fixed failing test

* linting

* fixing failing test

* version bump

* compiler fixes

* Connection type usages replace to DataSource

* updated dev deps

* updated deps, add prettier, removed oracledb due to m1 issue

* chalk downgrade

* fixing failing test

* applied prettier formatting

* replaced eslint to prettier

* okay I think we can call it lint

* fixing linting

* fixed prettier introduced compiler bug

* fixed failing test

* prettier;

* fixed failing test

* alias shortening only for junction tables;
fixed failing tests;

* changed aurora db names and reverted change of junction table name shorten algorithm

* format

* removed platform from docker compose

* made numeric parameters to not use parameters to prevent parameters number limit issue. Also enabled shorten only for junction tables

* fixing test

* fixing returning columns bugs

* fixing test

* fixed returning issue

* fixing merge conflicts

* updating documentation

* working on docs / improving api

* working on docs

* fixed isConnected issue

* re-worked commands

* commenting cli command tests for now

* commenting cli command tests for now

* removed platform

* returned Connection back

* refactor: export tree repository helper methods (#8753)

* Migrated protected tree methods to util class

* Added tree repository extend override

* Ran prettier format

* merge master into 0.3.0

Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>

* working on documentation

Co-authored-by: Bilel Taktak <47742269+Parsath@users.noreply.github.com>
Co-authored-by: Salah Azzouz <52634440+Salah-Azzouz@users.noreply.github.com>
Co-authored-by: Daniel Hensby <dhensby@users.noreply.github.com>
Co-authored-by: Nebojša Cvetković <nebkat@gmail.com>
Co-authored-by: Philip Waritschlager <philip+github@waritschlager.de>
Co-authored-by: James Ward <james@notjam.es>
Co-authored-by: Felix Gohla <37421906+felix-gohla@users.noreply.github.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
Co-authored-by: Jimmy Chen <50786287+Q16solver@users.noreply.github.com>
Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>
2022-03-17 21:01:45 +05:00
Tom Welsh
96ac8f7eec
feat: add transformer to ViewColumnOptions (#8717)
* feat: add transformer to ViewColumnOptions

Added `transformer` field into ViewColumnOptions
Allow view column to unmarshal by custom ValueTransformer

* docs: add supported view-entity column options

* updated docs

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2022-03-02 21:14:07 +05:00
Joe Flateau
87443954b5
feat: add option to upsert to skip update if the row already exists and no values would be changed (#8679)
* feat: add an option to upsert to allow skipping the update if no values have changed

* fix: relocate InsertOrUpdateOptions file with query-builder

* fix: only allow where is distinct from excluded on postgres

* fix: only expect postgres to skip the upsert update where nothing changed
2022-02-22 14:20:51 +05:00
Paweł Antyporowicz
7dbe956c56
feat: embedded entities with entity schema (#8626)
* feat: Embedded entities with entity schema

Added `embeddeds` field into EntitySchemaOptions
Added transformation to MetadataArgsStorage for embedded entities
Updated docs
Created new tests cases for EntitySchema with Embedded Entities
Changed type for field: `target` in EmbeddedMetadataArgs

CLOSES: #3632

* fixed docs

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2022-02-17 22:31:11 +05:00
Leandro
60a5b84826
docs: update select-query-builder RelationQueryBuilder with a example (#8658) 2022-02-17 20:49:22 +05:00
spotykatch
93383bd2ee
feat: separate update events into update, soft-remove, and recover (#8403)
Closes: #8398

BREAKING CHANGE: update listeners and subscriber no longer triggered by soft-remove and recover
2022-02-15 18:05:05 +05:00
Bilel Taktak
24efafae6a
docs: update relations-faq.md typo (#8614)
change the line 46 in relations-faq.md:
"Sometimes you want to have in your object id of the related object without loading it. "
into this: 
"Sometimes you want to have, in your object, the id of the related object without loading it. "
2022-02-12 19:02:49 +05:00
Salah Azzouz
49d9e9b426
docs: adjust grammatical error (#8615)
The following grammatical adjustments are related to the "Avoid relation property initializers" section, found in the relations-faq page;
1. Adjust the grammatical error found in the following phrase "But if you have initializer" by adding "an" before the word "initializer".
2. Adjust the grammatical error found in the following phrase "the loaded object will look like as follow" by removing the "like" word and adding an "s" to "follow".
2022-02-12 19:02:23 +05:00