Skip to content

What about migrations? #55

@kaning

Description

@kaning

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions