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

Proposition to Community For Feature Implementation #64

Open
anthonybtedesco opened this issue Jun 28, 2024 · 3 comments
Open

Proposition to Community For Feature Implementation #64

anthonybtedesco opened this issue Jun 28, 2024 · 3 comments

Comments

@anthonybtedesco
Copy link

I'm finding it annoying that everytime I update my database schema I lose all of my "models.rs macros" (derive statements and the like) and "impl blocks" and have to manually reformat the document to fix my structs and add my blocks. What if diesel_ext could only format the necessary bits of information rather than generate the entire schema.

Could this be done? I might be interested in working on a solution.

@abbychau abbychau assigned abbychau and unassigned abbychau Jun 28, 2024
@abbychau
Copy link
Owner

abbychau commented Jul 4, 2024

how do you want to suggest making this happen?

@anthonybtedesco
Copy link
Author

anthonybtedesco commented Jul 8, 2024

@abbychau Hey Abby, thanks for getting back I'm not entirely sure as I haven't looked at the code base but I'd imagine it would be a merge function on the newly generated models.rs and the current one in project scope. essentially just don't touch the derives and only edit the actual fields of the structs. Currently diesel_ext only generates based on the schema.rs file this would require taking the current models.rs into the process.

EDIT
I just looked at the options and it looks like there is an option to add derives. Would it be possible to get a list of the current derives used and have an option to add those by default. As for the other macros that may be present that could be done with the linux diff command and any line starting with '#' character.

@abbychau
Copy link
Owner

I see...struct merge.

looks to be quick a specific workflow. Do you have some specific examples?

a file with structs u created, then a file with structs after regeneration, then the expected result.
what is the strategy for the fields with the same names?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants