Closed jjangga0214 closed 1 year ago
i dont know what this is about, please expand your issue with the diesel schema and what you expect as output
@hasezoey Thank you for the prompt reply :) It was a quick question about whether dsync itself supports it or not. But your answer sounds like dsync does support it, but I missed something, which was what I hoped.
// src/schema.rs
use diesel::sql_types::*;
use diesel::{allow_tables_to_appear_in_same_query, joinable, table};
table! {
user (id) {
id -> Uuid
}
}
table! {
count (id) {
id -> Uuid,
user_id -> Uuid,
}
}
joinable!(count -> user (user_id));
allow_tables_to_appear_in_same_query!(user, count);
// src/models/count/generated.rs
#[derive(Debug, Serialize, Deserialize, Clone, Queryable, Insertable, AsChangeset, Identifiable, Associations, Selectable)]
#[diesel(table_name=count, primary_key(id), belongs_to(User, foreign_key=user_id))]
pub struct Count {
pub id: uuid::Uuid,
pub user_id: uuid::Uuid,
}
I looked around it, and found they are generated well. But I don't know why this is happening.
Maybe this is not an issue of dsync, but would you help if you know something?
Thank you :)
did you import the BelongingToDsl
trait? (importing it is required to be able to use its functions)
Yes, by use diesel::prelude::*;
.
then i dont think i can help too much, because i have not used that functionality yet, and the dsync tests are not in the best of states (they are currently only hand checked, but not checked that they actually compile and / or run)
Thank you anyway. Closing the issue.
I left a discussion from diesel's side. Here a link is for folks who may come later.
@hasezoey thanks for jumping on these issues!
@jjangga0214 I've used the generated belonging_to successfully in the past. Checkout this example from the diesel repo, it might help: https://github.com/diesel-rs/diesel/tree/2.1.x/examples/postgres/relations
It seems
belonging_to
is not supported. Is this true?