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
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
* 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 <j.fernandez@lionline.de>
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
the `next` branch has a number of style fixes for the project aroundnd
whitespaces - this pulls them into `master` to cut down on the files
changes between the two branches
move on-error-release code to the queryRunner connect function
so we only need to have one listener per query runner on each
connection - cutting donw the number of listeners total &
preventing a problem with too many listeners
closes#6699
* feat: Beautify generated SQL for migrations
Allows user to pass an optional flag to beautify generated SQL for migrations
Closes: #4415
* fixed formatter version
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
before sql.js 1.2 it seems undefined were treated as if they were null,
but as of 1.2 they cause a query error & fail to execute
this change swaps out any undefined parameters with `null`s
closes#5720
* fix: Unnecessary migrations for unsigned numeric types
In MariaDB, unsigned numeric types (``<tiny,small,medium>int`) without an explicit `width` property set would generate migrations on every run. This is due to an error in setting the default width for unsigned types.
Fixes#2943
* test: Enable all tests
* refactor: Move isDefaultColumnWidth() method out of BaseQueryRunner
See https://github.com/typeorm/typeorm/pull/6632#pullrequestreview-480932808 for discussion as to why.
* fix: Correct unsigned int behaviour for MySQL 5.7
* fix: Correct position of zerofill check
Plus stylistic change based on code review
* test: Testing that the discriminatorValue gets saved for ChildEntity when saved by cascade
* test: Update assertions to not be specific to retrieval order
Co-authored-by: Gareth Parker <gareth.parker@ros.gov.uk>
* refactor: add two examples to use timesteamp when create migration using js/ts
* refactor: add two examples to use timesteamp when create migration using js/ts
* fix: (sqlite) get correct increment primary key for mutiple entities inserted
Closes: #2131
* fix: (mysql) get correct increment primary key for mutiple entities inserted
Closes: #5973
* test: add test case for fix of #2131
* docs: update note about sqlite lastID
* fix: Unnecessary migrations for fulltext indices
Fixes#6633 (see issue for root cause explanation)
* test: Enable all tests
* refactor: Add `isFullTextColumnTypeSupported()` method to Driver interface
* fix: Include isFullTextColumnTypeSupported method in SqlServerDriver
* fix: Migration issues with scale & precision in sqlite/sql.js
Specifying precision or scale properties on columns with SQLite/sql.js would result in migrations being generated even on an unchanged schema.
This was due to the precision and scale arguments not correctly being inferred when reading the table. This change handles scale and precision in the same way that "length" was already being correctly handled.
Fixes#6636
* awaited the test
* fix missing async
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Right now the CLI will ALWAYS prepend the CWD to `options.cli.migrationsDir`.
This prevents us from using absolute paths there.
How would we feel about changing that to support absolute paths (by only prepending CLI if the path DOES NOT start with "/")? If we're open to it, I'm happy to make the change for the other CLI commands as well.
Change InsertQueryBuilder.values() with an empty array into a no-op instead of the current behavior of inserting a row of DEFAULT values.
Closes: #3111
the lockfile we use was generated on a mac & includes
`fsevents` as a dependency. while this is optional for
OSX it's not available for linux & this causes problems
with the `npm ci` command. npm v7 will correct this
but until we're using that we should switch to
using npm install