Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport database views in diesel print-schema #1482
Comments
This comment has been minimized.
|
Unfortunately, we can't really do this until we more generally separate "data sources" from "tables". The problem is that all tables in Diesel must have a primary key, and there's no way that we could infer that. Humans can just pick a random arbitrary column and call that the primary key (and many views actually do logically have one), but I don't want to do that in Diesel CLI |
sgrif
closed this
Jan 16, 2018
This comment has been minimized.
lukesutton
commented
Jan 16, 2018
|
Totally fair! I imagined there was some constraint there. My approach at this point has been to synthesize a primary key for rows in views and manually add |
This comment has been minimized.
|
Yup, that's the work around. For the record, I closed this issue, because that specific feature is not something we can support. That said, I do want to support views in general, as a separate concept from |
lukesutton commentedJan 16, 2018
Problem Description
The
diesel print-schemacommand doesn't output definitions for database views in Postgresql.What are you trying to accomplish?
For more complex queries I would like to be able to create a view in the database and associate it with a
Queryablestruct. This would be especially useful, since Postgresql now has support for materialized views.What is the expected output?
I would expect the diesel cli to output macro calls for views. If not by default then as an option.
What is the actual output?
All tables, but no views.