We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Troubleshooting Ecto Associations and Insert Query
218
clicks
Source: reddit.com
George Summers has encountered a problem while working with Ecto, the database wrapper and query generator for Elixir. The project involves processing and storing data from API polling into a SQLite database. George has set up schemas for `User`, `Chat`, and `Counter` with `has_many` and `belongs_to` associations. However, when attempting to insert a new `Counter` with associated `User` and `Chat` entries, the code is failing with an error indicating that the `counters` table lacks a `chat_id` column. George provided the `Counter` schema and migration details, highlighting the absence of `_id` fields in the user code and confusion about why Ecto is looking for these fields during insertion.
Related posts
© HashMerge 2024