You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently TypeORM puts database/schema name when migration:generate, and expects to match when comparing schema with current DB status, but these are depends to environment (e.g. some developer uses app_dev to DB name, but another developer may uses app_development or generated name by SaaS user_12345_app_development), so we shouldn't depends to it.
Expected Behavior
even migration:run and migration:generate runs on another DB name, it shouldn't make any new migration file.
Actual Behavior
If migration:generate runs on another DB name, it will make new migration file.
Steps to reproduce
Create new project
Add some fields that needs typeorm_metadata table (e.g. generated columns) and run typeorm migration:generate to make migration.
Create & Set to use new database with another name, and run typeorm migration:run.
run typeorm migration:generate again.
My Environment
Dependency
Version
Operating System
macOS 13.2
Node.js version
19.2.0
Typescript version
4.9.4
TypeORM version
0.3.11
PostgreSQL
14.6 (Homebrew)
Additional Context
I'm not sure about my thoughts (=typeorm_metadata shouldn't depends to database/schema name) is correct.
If my thoughts is correct, please tell me. then I will start working for this.
Sorry I forgot this issue, I will work this after beats Zelda TotK.
alternative workaround: you can UPDATE existing typeorm_metadata everytime before generates migration, It would be like UPDATE typeorm_metadata SET database=current_database()
My workaround above somehow wasn't good enough and our team started encountering strange behaviour which we have no time to debug.
We just got rid of the generated column in favour of calculating the value dynamically, luckily our use case is not resource-constrained. This issue is a bummer, generated columns would be a really neat checksumming solution for us.
I am experiencing the same issue (postgres). typeorm migration:generate creates new migration file for already run Generated Column if the database name does not match.
This makes Generated Columns unusable.
Issue description
currently TypeORM puts database/schema name when
migration:generate
, and expects to match when comparing schema with current DB status, but these are depends to environment (e.g. some developer usesapp_dev
to DB name, but another developer may usesapp_development
or generated name by SaaSuser_12345_app_development
), so we shouldn't depends to it.Expected Behavior
even
migration:run
andmigration:generate
runs on another DB name, it shouldn't make any new migration file.Actual Behavior
If
migration:generate
runs on another DB name, it will make new migration file.Steps to reproduce
typeorm_metadata
table (e.g. generated columns) and runtypeorm migration:generate
to make migration.typeorm migration:run
.typeorm migration:generate
again.My Environment
Additional Context
I'm not sure about my thoughts (=typeorm_metadata shouldn't depends to database/schema name) is correct.
If my thoughts is correct, please tell me. then I will start working for this.
related: #4925 (but it is on MariaDB/MySQL)
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
The text was updated successfully, but these errors were encountered: