Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
5 replies
barry

drizzle many-to-many

https://gist.github.com/barrybtw/f4c54bf7bdac98af34069363d7b1be87

Trying to setup a many-to-many relationship between calendar and user. But I'm getting some weird Typescript errors.
Argument of type 'Relations<"calendar_participant", { calendar: One<"calendar", true>; user: One<"user", true>; }>' is not assignable to parameter of type 'Table<TableConfig$3<Column<any, object, object>>>'.ts(2345)
Argument of type 'Relations<"calendar_participant", { calendar: One<"calendar", true>; user: One<"user", true>; }>' is not assignable to parameter of type 'Table<TableConfig$3<Column<any, object, object>>>'.
Type 'Relations<"calendar_participant", { calendar: One<"calendar", true>; user: One<"user", true>; }>' is missing the following properties from type 'Table<TableConfig$3<Column<any, object, object>>>': _, getSQL, [IsDrizzleTable]ts(2345)
Gist
GitHub Gist: instantly share code, notes, and snippets.
drizzle.schema.ts
Solution
oh wait im a dumb dumb i was using the relation definition instead of the table for the many relation input
Was this page helpful?