-
Notifications
You must be signed in to change notification settings - Fork 30
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
Not able to make the crate work "the trait diesel::Expression
is not implemented for enums::AccountStatus
"
#62
Comments
The line
should read
Take a look at the README for more information. |
Hi Thank you for this information, but I do not manage to make the type detection work so I still have to edit the schema file by hand |
This is a basic problem with how Diesel generates a schema and is not really under control of this crate. There is a suggested solution here: #53. Basically, make a 'dummy' module where you re-export the Mapping type under a different name, and import the module inside the |
This fixed all errors as you expected: air-balloon/api@8d8c526 That said it still does not detect my enum and creates this diff when I run the migrate command: diff --git a/src/schema.rs b/src/schema.rs
index ac9656d..93626f1 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -9,7 +9,7 @@ table! {
username -> Varchar,
first_name -> Varchar,
last_name -> Varchar,
- account_status -> AccountStatusMapping,
+ account_status -> Enum,
timezone -> Nullable<Varchar>,
first_log_in_at -> Nullable<Timestamp>,
last_log_in_at -> Nullable<Timestamp>, I tried the re-export method but I made this error whatever I tried
|
Ah, I see you are using MariaDB. It seems that Diesel does it's enum name mangling differently to Postgres. Your options are to a) re-export |
Yup, MariaDB Do you think you can have a chance to get this fixed here ? |
The fundamental problem is that when generating the schema, Diesel looks at the database and decides that your type should be given the name Note that this problem only occurs when generating the schema, which typically only has to be done once. When I have hit this problem before I have just hand-edited the |
I should add that this crate is intended to support every database that Diesel supports. But it happens to be that Postgres has the best support for enums and thus gives a better experience |
Okay, maybe a bunch of documentation would be cool so other mysql users dont waste time searching for something they will not find Adding a mysql example and some notes on the readme could be possible? |
Closing since I do no recall what this was about exactly |
I added your crate and did the config in: air-balloon/api@b5ec7ce
Summary of the problems:
account_status -> Enum,
that does not workthe trait diesel::Expression is not implemented for enums::AccountStatus
errorsIf I apply this diff (to un-hack my compiling version)
I get the following errors
Thank you in advance for helping me, I am new to Rust and am stuck on this error.
I checked in your tests folder but did not find something that helped, that said I applied all valid examples into mine.
The text was updated successfully, but these errors were encountered: