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

What about migrations? #55

Open
kaning opened this issue Oct 16, 2024 · 0 comments
Open

What about migrations? #55

kaning opened this issue Oct 16, 2024 · 0 comments

Comments

@kaning
Copy link

kaning commented Oct 16, 2024

I stumbled on your post while researching how to use postgres views with diesel. I had seen this workaround before but this articled helped solidify some things I was thinking about.

What it does not mention though is that if you manager your schema with migrations, Diesel will leave you in the cold, because it only prints-schemas with tables and such... Views will go missing every time diesel regenerates your schema file.

A way to fix that is to use the patch_file config in the diesel.toml... If you create a patch file from the diff of your view in the schema.rs file, it will apply the patch AFTER it generates the schema and you have your views remaining in the schema.rs.

Hopefully this helps someone

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

1 participant