diesel-rs / diesel_full_text_search

MIT License
72 stars 33 forks source link

Tsvector type name mismatch #8

Closed notriddle closed 3 years ago

notriddle commented 5 years ago

When I ran diesel migration redo, it generated a type with the name Tsvector in the schema.rs file, while this library exposes a type called TsVector.

That seems wrong. Am I doing something wrong here?

kaj commented 4 years ago

I have the same problem, but since I must edit the generated schema.rs anyway to add use diesel_full_text_search::TsVector in the table! macros that uses it, I just edit Tsvector to TsVector manually for now.

Unfortunatley, the table! macro does not support use diesel_full_text_search::TsVector as Tsvector;, which might otherwise be a nice way to fix it.

It would be nice to have the schema generator procude a working schema.rs automatically.

weiznich commented 4 years ago

This should be fixed now with https://github.com/diesel-rs/diesel/pull/2060

Supporting use diesel_full_text_search::TsVector as Tsvector; in the table! macro seems like a good idea. If someone want's to work on this, basically only this line needs to be changed in such a way that the renaming of an import is also matched.

kaj commented 4 years ago

This should be fixed now with diesel-rs/diesel#2060

I don't think so. Since the sql name is TSVECTOR (and not TS_VECTOR) it will be camelcased as Tsvector with a lower-case v.

weiznich commented 4 years ago

A PR adding a hidden type alias with the name generated by diesel cli would definitively something I would accept.

GopherJ commented 4 years ago

strange I manually added:

use diesel_full_text_search::TsVector;

and changed Tsvector to TsVector but seems still not working:

image

what shall I do to fix this? @weiznich

GopherJ commented 4 years ago

Ok sorry seems I need to write like:

 table! {
+    use diesel_full_text_search::TsVector;
+    use diesel::sql_types::VarChar;
+    use diesel::sql_types::Float8;
     venues (id) {
-        id -> Varchar,
-        street -> Varchar,
-        city -> Varchar,
-        postcode -> Varchar,
+        id -> VarChar,
+        street -> VarChar,
+        city -> VarChar,
+        postcode -> VarChar,
         lat -> Float8,
         lng -> Float8,
-        market_id -> Varchar,
+        market_id -> VarChar,
+        street_city_poscode_search_entity -> TsVector,
     }
 }
weiznich commented 3 years ago

Should be fixed with #24