Skip to content

Conversation

@dolsup
Copy link
Owner

@dolsup dolsup commented Oct 25, 2020

update master

dolsup and others added 30 commits May 18, 2020 10:13
"plan javascript object" -> "plain javascript object"
Previous URL returns a 404
added `AuroraDataApiPostgresDriver` to `BrowserDisabledDriversDummy.template` to fix typeorm not compiling when using browser target
…6106)

Co-authored-by: Sergio Durban Belmonte <sdurban@leadtech.com>
Weirdly search sent me here, and it took a while to find the real TypeORM website.
There was no documented way of setting a connection timeout for the
postgres driver. We recently ran into an issue with our network that
caused a container to hang indefinitely attempting to connect to
postgres.

We managed to resolve the issue by setting 'connectionTimeoutMillis' in
the 'extra' field of our connection options. This approach does not
appear to be documented anywhere.

Seeing that MongoDB and MySQL drivers both support a connection timeout
as part of the documented API, we felt it made sense to add a similar
option to the Postgres driver and hopefully avoid some headaches down
the road.

This commit adds a 'connectTimeoutMS' option to the postgres driver
that gets translated to the appropriate field for the pg library. It
also updates the documentation to reflect this new option.

Because the default behavior of the underlying pg library is to attempt
to connect indefinitely, we didn't feel like it was a safe change to
introduce a default timeout, even if that's more sane behavior.

As mentioned earlier, both the MySQL and MongoDB drivers support a
connection timeout option. MySQL uses 'connectTimeout' while MongoDB
uses 'connectTimeoutMS'. We went with 'connectTimeoutMS' as to not
introduce yet another name for a connection timeout, and because the
'MS' suffix makes it clearer what is expected.

We hope a future PR may adjust the MySQL connection options to adopt the
same name, but will leave that up to someone with a stronger opinion.
The `repository` variable is not defined in the first Data Mapper pattern example
JSON body parser is now built-in by default (>4.16.0), hence no need for body-parser
Example for querying subdocuments and array of subdocuments
* fix: properly override database url properties

Closes #4878

* test: add test for overriding url options
* support cjs extension for ormconfig

* fix linting errors

* handle cjs extensions in class loader
…lDriver (#6237)

fix: lint warning

Co-authored-by: shitong.zheng <shitong.zheng@shopee.com>
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ns.md cascades link (#6406)

* docs: one-to-one-relations.md cascades link

* docs: many-to-one-one-to-many-relations.md cascades link
…d entities (#6402)

Closes: #6399

Co-authored-by: Gregory Komagurov <Komagurov.GV@gazprom-neft.ru>
imnotjames and others added 28 commits October 13, 2020 09:07
this updates the shim to include all current decorators
exported from index.ts - adding @unique and a few others

fixes: #6288
fixes: #5920
the CLI command `query` had an implicit `query` positional
parameter and in earlier versions of yargs that was okay -
but in the later versions aiming for more correct code they've
refactored it to not support that

explicitly define the `query` positional parameter & add a
helpful description so people can tell what it is for

fixes #6896
add a `comment` method to the QueryBuilder so we can include an
arbitrary comment in our queries for a variety of purposes -  from
query plan stability to SQL reverse proxy routing, to debugging.
the comment builder is supported in selects, inserts, deletes, and
updates

this is directly inspired by the functionality supported by hibernate
to handle SQL Query comments

it uses C-style queries which are ANSI SQL 2003 & supported in all
of the dialects of SQL that we support as drivers

fixes #3643
we were supporting an empty `IN` clause for MySQL and Oracle
and this updates the handling to be for all other dialects as well
by making the "empty" clause be `0=1`

Closes #4865
fixes #2195
This adds a `getOneOrFail` which which is to `getOne` as
`findOneOrFail` is to `findOne` - it never returns `undefined`,
it will instead throw an `EntityNotFoundError`

closes #6246
Correct the description for setting a custom table name for the typeorm cache.
the query comment test was causing problems in a few other PRs because it expects a very specific comment then verb pattern - which may or may not always be the case.
update the ConnectionOptionsReader so that ormconfig.env files
are loaded as expected from the filesystem & included as a dotenv
configuration
the `buildDriverOptions` parses the URL & will have undefined values
which it ends up overwriting non-undefined values with - which isn't great
test 6900 only ran correctly in local testing & didn't correctly
handle the different hostnames in CI / CD
in the mysql driver, column comments were only half supported -
adding them to new columns & new tables was possible, but updating
existing columns to include comments was not possible

there also was no escaping done on the column comments - so depending
on the contents of your comment, an invalid query could be generated

adds support to add comments to existing columns, adds simple comment
escaping code, & creates tests to verify the behavior
adds support for column comments to both the Postgres and
CockroachDB driver - for migrations & in metadata.  also includes
new tests that validate the functionality works as expected

fixes #3360
I haven't inspected the code to know if string or any other type does get returned, but this can at least inform people without needing to inspect the code that it can be an easily parsable Error instance.
If an entity has the same discriminator value as one using `TableInheritance` this should be allowed as 
there is no way for them to conflict.

This commit also fixes the discriminatorColumn 
check to check all the entities it should be
checking. Only the parent in an STI setup has the
"STI" inheritancePattern, the children just have the 
"entity-child" tableType. Before two children with 
the same discriminatorValue would be
(incorrectly) allowed as they'd never even get 
checked.

Fixes #2984
…e. (#6942)

Previously "id" was hardcoded, thus errors when an entity
has a custom primary column name other than "id". Now
it fetches the column name from metadata instead.
handle setting values deeply in entities with relations in ColumnMetadata,
also check for a virtual relationship column in rawsqlresultstoentitytransformer

this allows us to handle a case where `many-to-one` with explicit composite PKs
columns were failing to persist a second time- instead of correctly updating the
field they would cause an insert to occur leading to a unique PK constraint error
* docs: remove unused variable in many-to-many-relations.md

* docs: remove unused variable in one-to-one-relations.md
without postgres v8+ nodejs 14+ will hang
@dolsup dolsup merged commit 24b00b8 into dolsup:master Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.