Regenerate migration for View Entity
Author: libtertyCreated Nov 20, 2021Updated Sep 23, 2026
Labelsbug
Issue Description
Expected Behavior
Migration should not be re-generate if view hasn't changed
Actual Behavior
All view created again during different migration
await queryRunner.query(...)
await queryRunner.query(`CREATE VIEW "todos_by_date_export_view" AS
SELECT
tfd."companyId",
...
`)
await queryRunner.query(...)Steps to Reproduce
- Create TodosByDateExportView
- Generate migration script
- Run migration
- Change some other entity definition
- Generate migration script again
@ViewEntity({
expression: `
SELECT
tfd."companyId",
...
`
})
export default class TodosByDateExportView {
@ViewColumn()
companyId: string;
...
}My Environment
| Dependency | Version |
|---|---|
| Operating System | Amazon Linux AMI 2018.03 |
| Node.js version | v12.22.1 |
| Typescript version | 4.0.5 |
| TypeORM version | 0.2.34 |
| Postgres version | 9.6.22 |
Additional Context
Looks like someone also report similar issue #8284
Relevant Database Driver(s)
| DB Type | Reproducible |
|---|---|
aurora-data-api |
no |
aurora-data-api-pg |
no |
better-sqlite3 |
no |
cockroachdb |
no |
cordova |
no |
expo |
no |
mongodb |
no |
mysql |
no |
nativescript |
no |
oracle |
no |
postgres |
yes |
react-native |
no |
sap |
no |
sqlite |
no |
sqlite-abstract |
no |
sqljs |
no |
sqlserver |
no |
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.
Source: typeorm/typeorm