-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue Description
Expected Behavior
I would like not regenerate virtual columns.
Actual Behavior
When I create a virtual column, each time I type typeorm migration:generate, typeorm dropped and regenerate virtual column.
Steps to Reproduce
- I create an entity with virtual column
@Column({
asExpression: `CONCAT(firstname, ' ', lastname)`,
generatedType: 'VIRTUAL',
length: 255,
nullable: false,
})
name: string;- I generate migration with
typeorm migration:generate - I regenerate migration
And I have this ouput in my migration :
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE \`user\` CHANGE \`name\` \`name\` varchar(255) AS (CONCAT(firstname, ' ', lastname)) VIRTUAL`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE \`user\` CHANGE \`name\` \`name\` varchar(255) AS CONCAT(firstname, ' ', lastname)) VIRTUAL`,
);
}My Environment
| Dependency | Version |
|---|---|
| Operating System | Linux Ubuntu 18.04 |
| Node.js version | 14.17 |
| Typescript version | 4.1.5 |
| TypeORM version | 0.2.41 |
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 |
mariadb |
yes |
nativescript |
no |
oracle |
no |
postgres |
no |
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.
fivemru, Ottavio97 and alef-carvalho