print-schema doesn't generate mappings
jasonlor opened this issue · 2 comments
jasonlor commented
Using:
diesel = { version = "1.4.3", features = ["network-address", "postgres", "r2d2", "uuidv07", "chrono", "network-address", "serde_json"] }
diesel-derive-enum = { version = "0.4.4", features = ["postgres"] }
I'm having an issue in generating the schema with the proper mappings with the following code:
Postgresql
CREATE TYPE my_enum AS enum ('apple', 'banana', 'cactus');
Rust
#[derive(DbEnum)]
pub enum MyEnum {
Apple,
Banana,
Cactus,
}
diesel print-schema returns the following.
table! {
random_table (id) {
id -> Uuid,
kind -> My_enum,
}
}
I've attempted to use #[DieselType = "My_enum"] but that doesn't seem to make a difference.
adwhit commented
I can recommend https://atsuzaki.com/blog/diesel-enums/ for a nice explanation of how to make print-schema!
work. Should probably link to it in the docs TBH
jasonlor commented
That worked perfect. Thank you!