New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: provide a way to customize generated migration and entity naming strategy #449
Comments
We can have a customizable callback to generate the name, why not, just keep in mind that those file names are used for ordering. Btw the example with windows issues and LC vs UC is kinda invalid, this is about migrations, they will be in a specific folder, all the content is generated, even if future ORM version would change the case, you still have the timestamp suffix. But what I can understand is that you simply want to have consistent file names across your app, so again, why not :]
Do not mix this with https://mikro-orm.io/docs/defining-entities#entity-file-names |
@B4nan , Callbacks sounds good. About ordering, I'm pretty used to umzug through sequelize-cli and even an own cross-db implementation; the best I can think of is, maybe, timestamp-first (and maybe .migration.ts suffix); but this is all opinions. Upvote for the callback. I'm pretty much starting with TS, and mikro-orm; and I have to say I'm seduced :) |
Hum; well about entities and NamingStrategy, I hadn't read that much the API. It's pretty great. Thinking of it... you argue
As far as I can read, this is about Class/prop-to-db-Table/col and the reverse operation. |
We can now adjust both the class name and the file name. Class names are controlled via `NamingStrategy.classToMigrationName()` and file names are controlled via `migrations: { fileName: time => '...' }` in the configuration. Closes #449
We can now adjust both the class name and the file name. Class names are controlled via `NamingStrategy.classToMigrationName()` and file names are controlled via `migrations: { fileName: time => '...' }` in the configuration. Closes #449
We can now adjust both the class name and the file name. Class names are controlled via `NamingStrategy.classToMigrationName()` and file names are controlled via `migrations: { fileName: time => '...' }` in the configuration. Closes #449
Is your feature request related to a problem? Please describe.
Currently, migrations are generated with upper case (just like migration class name).
This can cause problems in some systems; and is a controversed strategy (not going into details here; trying not to be polemic)
Describe the solution you'd like
It would be a good thing to have the ability to customize the file-naming-strategy; just like config allows
namingStrategy: UnderscoreNamingStrategy
(for table names I assume; just discovered this).Maybe :
Which would generate
migration-20200402211502.ts
instead ofMigration20200402211502.ts
EDIT: Maybe along with some prefix / suffix customization; to be able to add things like
.model.ts
automatically for entities.Describe alternatives you've considered
Additional context
To expand on kebab versus camel. (still avoiding debate, just to say some have reasons to prefer kebab-everywhere, and that it's a decent use-case)
try this
aFile.js
another-one.js
Now retry this on windows, mac, and ubuntu.
It might give different results.
Also :
The text was updated successfully, but these errors were encountered: