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

Support "rename model" in automatic migration generator #208

Open
m4tx opened this issue Feb 25, 2025 · 0 comments
Open

Support "rename model" in automatic migration generator #208

m4tx opened this issue Feb 25, 2025 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@m4tx
Copy link
Member

m4tx commented Feb 25, 2025

We should support renaming models in the automatic migration generator.

This is more complicated than most of the other operations. This is because we can't reliably detect renaming models (we only see that a model has been removed and then created). For starters, we could detect if a model was renamed by keeping all of the fields intact. Then, we could add some heuristics (like for instance, we see that a model was removed but then recreated with 80% of its original fields). This, however, needs to be interactive—we need to ask the developer if they actually renamed the model (and then create either a rename, or delete+create operations depending on their reply).

The entry point is probably somewhere in the generate_operarations function:

fn generate_operations(

This will require adding a new OperationInner variant:

enum OperationInner {

Note that the "rename model" operation will need to store the old name of the model, so that an implementation of Operation::backwards can be created.

@m4tx m4tx added the enhancement New feature or request label Feb 25, 2025
@m4tx m4tx added this to the v0.2 milestone Feb 25, 2025
@m4tx m4tx added this to Roadmap Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant