Skip to content
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

Fix one-to-many relationship for SQLite and MySQL #53

Open
mjovanc opened this issue Apr 12, 2024 · 1 comment
Open

Fix one-to-many relationship for SQLite and MySQL #53

mjovanc opened this issue Apr 12, 2024 · 1 comment
Labels
feature New feature or request mysql sqlite Issues related to SQLite
Milestone

Comments

@mjovanc
Copy link
Member

mjovanc commented Apr 12, 2024

We need to be able to fix the possibility of storing a vector of structs that derive the Table procedural macro:

#[derive(Table)]
#[table_name = "orders"]
pub struct Order {
    id: usize,
    user: User,             // one-to-one relationship
    products: Vec<Product>, // one-to-many relationship - populates from based on junction table (gets from macro attribute "table_name" and combines them for example, orders_products)
    total_cost: f64,
}

As you can see here when we define a field called products and add a vector of Product. It will complain about:

- doesn't satisfy `syn::Type: ToString` or `syn::Type: std::fmt::Display`

We need to be able to support this in the njord_derive library.

@mjovanc mjovanc added the sqlite Issues related to SQLite label Apr 12, 2024
@mjovanc mjovanc changed the title Fix many-to-many relationship for SQLite Fix one-to-many relationship for SQLite Apr 12, 2024
@mjovanc mjovanc added the feature New feature or request label Apr 21, 2024
@mjovanc mjovanc added this to the 0.3.0 milestone Apr 21, 2024
@mjovanc mjovanc modified the milestones: v0.3.0-alpha, v0.4.0-alpha May 8, 2024
@mjovanc mjovanc modified the milestones: v0.4.0-alpha, v0.5.0-alpha Oct 19, 2024
@mjovanc mjovanc changed the title Fix one-to-many relationship for SQLite Fix one-to-many relationship for SQLite and MySQL Oct 19, 2024
@mjovanc mjovanc added the mysql label Oct 20, 2024
@mjovanc
Copy link
Member Author

mjovanc commented Nov 18, 2024

@chaseWillden Do you have any idea how we can solve this if we haven't already?

@mjovanc mjovanc modified the milestones: v0.5.0-alpha, v0.6.0-alpha Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request mysql sqlite Issues related to SQLite
Projects
None yet
Development

No branches or pull requests

1 participant