Skip to content

merge master#1

Merged
lusess123 merged 113 commits intolusess123:masterfrom
typeorm:master
Oct 5, 2020
Merged

merge master#1
lusess123 merged 113 commits intolusess123:masterfrom
typeorm:master

Conversation

@lusess123
Copy link
Owner

merge master

0xflotus and others added 30 commits July 3, 2020 00:58
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 <[email protected]>
…ns.md cascades link (#6406)

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

* docs: many-to-one-one-to-many-relations.md cascades link
update type definition and schema transformer
so that - like the decorator - the EntitySchema can define
composite `JoinColumn` definitions

Closes: #5444
getPendingMigrations currently returns the executed migrations instead of the non-executed ones.
* feat: better-sqlite3 driver which is significantly faster than node-sqlite3
* test: added all tests for sqlite to better-sqlite3
* test: "query runner > drop column" modified compatible
* docs: added better-sqlite3 related docs
* fix(aurora): pass formatOptions to Data API Client, fix UUID type support and all other extensions

* fix(aurora): refactored the code to avoid duplication (#1)

* fix(aurora): refactored the code to avoid duplication
… width (#6444)

* fix: provide width to ColumnMetadataArgs for JoinTable

@jointable does not respect inverseJoinColumns referenced column width

Closes: #6442

* fix: address linting errors, replaced single quotes

* fix: add await so that promises are resolved

* fix: add connection close for migration connection
imnotjames and others added 29 commits September 17, 2020 16:09
this bumps the version of typescript accepted to >=3.9.7,<4.0
we were implicitly pulling in that version (per the package-lock.json)
so this just codifies it in the package.json as well
this test was emitting logs for no real reason so this removes the
`logging: true` when creating the testing connection
* Update MysqlQueryRunner.ts

In Mariadb the extra information of a DDL is in upper case and in javascript String.indexOf() function is case sensitive, because of that when you generate a new migrations  in mariadb it always create a line to update  "onUpdate" lines.

 example:
```sql
CREATE TABLE `test` (
  `test_id` int(11) NOT NULL AUTO_INCREMENT,
  `test_update` timestamp() NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
```

When you try to generate a new migration always create the next migration file:

```ts
import { MigrationInterface, QueryRunner } from 'typeorm';

export class test261600082802966 implements MigrationInterface {
  name = 'test261600082802966';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      'ALTER TABLE `test` CHANGE `test_update` `test_update` timestamp() NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()'
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      'ALTER TABLE `test` CHANGE `test_update` `test_update` timestamp() NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE current_timestamp()'
    );
  }
}
```
Entity file test.ts
```ts
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@entity()
export class test extends BaseEntity {
  @PrimaryGeneratedColumn({})
  test_id: number;

  @column({
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP()',
    onUpdate: 'CURRENT_TIMESTAMP()',
    nullable: false,
  })
  test_update: Date;
}
```

* Update MysqlQueryRunner.ts

* add test to issue 6714

* Update MysqlQueryRunner.ts

* Update issue-6714.ts

Co-authored-by: jesusegado <[email protected]>
* Update many-to-many-relations.md

* Update many-to-many-relations.md

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

This feature for postgres connections means when you pass the logNotifications option, db notices and notifications will be passed to the logger with info log level

Closes: #2216
currently we pull in BetterSqlite3Driver, SqliteDriver, and a few other
drivers & files that aren't possible to use in a browser context.
this change adds some more browser compatibility features so
webpack builds targeted at browsers will be able to complete

closes #6739
* fix: count() method for multiple primary keys for cockroachdb

Cockroachdb does not support concat() for different types at the moment.
To fix this problem, each primary key is cast to the text type.

* fix: add doublequote

* fix: add doublequote

* test: update and move tests for count() method for multiple primary keys

* fix: count() method for multiple primary keys for oracle

Oracle does not support CONCAT() for more than 2 arguments at the moment.
To solve this problem, operator || is used instead of CONCAT().
create a type to track ReplicationMode instead of writing out
`"master"|"slave"` everywhere.

update to drop the default from the QueryRunner constructor
as they will always receive the mode from the driver when
it's part of the QueryRunner

also drop the default from Driver.createQueryRunner in the
implementations - the interface mandates the mode to be defined
so it will never be omitted anyway

also drop the explict "master" from any connection.createQueryRunner
calls so we leave it either the default or `slave` when needed

all of this makes it easier to eventually migrate to
other naming convetions for the replication mode
should it be deemed the right path to go down
* stop using PromiseUtils.create & extractValue as they're doing nothing

because we never use PromiseUtils.create, PromiseUtils.extract was technically
never used either - the only case we were using this was in a test
where we can replace it with Promise.resolve

* stop using PromiseUtils.settle in test 1014

there was no reason to use this call in the test
as it was not using the results and only used the `Promise.all`
functionality

* use Promise.all instead of PromiseUtils.runInSequence in tests

in these cases of PromiseUtils.runInSequence in tests there was no need
for us to be running them in sequence - so instead we could use Promise.all
& Array.map for a replacement.  removes the dependency on PromiseUtils &
also speeds up our tests

* run tests sequentially for those that deal with ActiveRecord

because the activerecord mechanism creates a "global" scope through
the class that ActiveRecord is applied to we have to run through the
connections sequentially or end up with them being all over the place
as far as what activerecord model is connected to what connection

* use standard async/await + for/of instead of runInSequence

in cases where actual order of the runs matter we can do for/of
and then await any of the results - because none of the usages of
runInSequence that rely on the correct order actually use the results

* use Promise.all on runInSequence cases where order doesn't matter

* drop PromiseUtils altogether

* sequentially run when dealing with QueryRunner

queryrunner is not 'thread-safe' or async safe

* drop the test to lookup by Promise

before, the test wasn't validating that you could lookup by promise
the test was verifying that if you used something that wasn't a promise
but instead had a magic __value__ variable you'd get a lookup

that's not a promise, unfortunately

I can't find that a promise may be passed into the find options anywhere
in the documentation so I've removed this test
* fix: resolve issues ora-00972:identifier is too long

Closes: #5067

* fix: ensure that this changes applies just for Oracle Driver

Closes: #5067

* fix test - remove `.only` & set the `enabledDrivers` to oracle

* simplify test case

Co-authored-by: Murat Gundes <[email protected]>
the expected type of `port` in all drivers is a number - and
in MSSQL this is a problem as the underlying driver does not
properly handle a string port - so we have to parseInt

closes #6781
)

for some reason the aurora postgres driver was living with the postgres
driver - instead of in the directory explicitly for the aurora postgres
driver.

this moves the aurora-pg driver into that directory so there's a clearer
delineation between the two drivers
* fix: enforce name argument of migration generate command

enforce the type of the name argument in order to return a more useful error message when the user forgets to provide a migration name to the generate migration command

Closes: #2719, #4798, #4805

* fix: update error message text for generate migration command when missing name argument

enforce the type of the name argument in order to return a more useful error message when the user forgets to provide a migration name to the generate migration command

Closes: #2719, #4798, #4805

Co-authored-by: Akosua Asante <[email protected]>
…6440)

in the `ReturningResultsEntityUpdator` we have to check that the `entityId`
we pull from the entity is actually there.  if we don't we will create a
where clause that's undefined - effectively querying for every record
in the database and returning the wrong value
Because of a breaking feature in Typescript 3.7.0 we cannot upgrade
past that without marooning users of Typescript 3.5 / 3.6 & 4.0+

this locks typescript to ~3.6.0 explicitly and fixes some small
issues that arise in using that version

fixes #6809
fixes #6805
Because react native uses the browser context we can't use `PlatformTools.load` so this reverts the behavior for this file to use a standard `require` call

Fixes #6811
the test for #6442 was accidentally named `6642`
…reateCommand (#6824)

somehow #6807 passed as a PR but failed when merged in - this fixes the issues
that cropped up after it was merged in
accidentally pulled over the entitiesDir instead - this fixes the
subscribers generation command writing to the correct directory
Fixes an edge case where the wrong foreign key 
would be loaded when multiple databases exist 
with foreign keys that have the same name.

Fixes #6168
bumps sql.js to 1.3.2 because 1.3.0 has a number of issues in the
compiled versions of the package
@lusess123 lusess123 merged commit 8be4015 into lusess123:master Oct 5, 2020
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.