Skip to content
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

loco generate model --migration-only for migration only #400

Closed
fan-tastic-z opened this issue Jan 26, 2024 · 2 comments
Closed

loco generate model --migration-only for migration only #400

fan-tastic-z opened this issue Jan 26, 2024 · 2 comments

Comments

@fan-tastic-z
Copy link
Contributor

fan-tastic-z commented Jan 26, 2024

Description

Currently, if cargo loco generate model posts does not have fields, a migration file will be generated and written to automatically execute the migration. During development, I usually think of generating the migration file first, then writing the fields one by one, and then manually Execute cargo loco db migrate.
Now if I write less fields in cargo loco generate model posts due to imperfect considerations, I must enter the database to delete the records.
Moreover, a table may have many fields during development. If the cargo loco generate model brings all the fields, it will easily become very long.
Whether to consider cargo loco generate model if it does not automatically execute cargo loco db migrate when it does not carry fields?

@jondot
Copy link
Contributor

jondot commented Jan 29, 2024

We can add a flag loco generate model --migration which means "generate only migration" and do not automatically generate the model.
Would that be OK?

@jondot jondot added this to the 0.3.0 milestone Jan 29, 2024
@fan-tastic-z
Copy link
Contributor Author

We can add a flag loco generate model --migration which means "generate only migration" and do not automatically generate the model. Would that be OK?

@jondot Yes, I think that's okay

@jondot jondot changed the title About cargo loco generate model loco generate model --migration for migration only Feb 1, 2024
jondot added a commit that referenced this issue Feb 1, 2024
@jondot jondot closed this as completed Feb 1, 2024
@jondot jondot changed the title loco generate model --migration for migration only loco generate model --migration-only for migration only Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants