-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
Issue Description
i created a passenger.entity.ts file added few fields over it.
Then i generated a migration named first and i run migration run command successfully and then i can feel changes to my PostgreSQL database,
after few minutes, again i generated a migration named second,
here i am surprised to see that the second migration even generate the same SQL query as of first migrations.
Expected Behavior
i believe when i run command to generated second migration, it should show "typeORM No changes in database schema were found - cannot generate a migration. To create a new empty migration use “typeorm migration:create” command "
Actual Behavior
when i run first migration, following code is generated:
import {MigrationInterface, QueryRunner} from "typeorm";
export class first1627232991461 implements MigrationInterface {
name = 'first1627232991461'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "passengers" ALTER COLUMN "is_deleted" SET DEFAULT 'false'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "passengers" ALTER COLUMN "is_deleted" SET DEFAULT false`);
}
}
when i run second migration command, following code is genetated:
import {MigrationInterface, QueryRunner} from "typeorm";
export class second1627234626276 implements MigrationInterface {
name = 'second1627234626276'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "passengers" ALTER COLUMN "is_deleted" SET DEFAULT 'false'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "passengers" ALTER COLUMN "is_deleted" SET DEFAULT false`);
}
}
Surprisingly in both case there is same sql query
Steps to Reproduce
name of my column is inside .entity.ts file is:
@Column({ name: 'is_deleted', type: 'boolean', default: 'false' })
public isDeleted: boolean;
My Environment
| Dependency | Version |
|---|---|
| Operating System | Ubuntu 20.04 |
| Node.js version | 14.16.1 |
| Typescript version | 4..2.4 |
| TypeORM version | 0.2.32 |
Additional Context
i believe following image clearly show this issue
Relevant Database Driver(s)
| DB Type | Reproducible |
|---|---|
postgres |
yes |
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ Yes, I have the time, and I know how to start.
- ✅ Yes, I have the time, but I don't know how to start. I would need guidance.
- ✖️ No, I don’t have the time, but I can support (using donations) development.
- ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
