Content Warning
🔗 Read the docs: https://hexdocs.pm/needle/readme.html
💬 Join the discussion on Elixir Forum: https://elixirforum.com/t/needle-universal-foreign-keys-shared-data-fields-virtual-and-configurable-schemas-for-ecto/65644
Content Warning
🔗 Read the docs: https://hexdocs.pm/needle/readme.html
💬 Join the discussion on Elixir Forum: https://elixirforum.com/t/needle-universal-foreign-keys-shared-data-fields-virtual-and-configurable-schemas-for-ecto/65644
Content Warning
When using a relational DB (such an Ecto schema with a Postgres table), usually a foreign key field has to be pre-defined with a reference pointing to a specific field in a specific table.
2/6
Content Warning
A social network, by contrast, usually requires a graph of objects, meaning objects need to be able to refer to other objects by their ID without knowing their type.
A simple example would be likes, you might have a likes table with liked_post_id field that references the post table.
Content Warning
We needed the flexibility to have a foreign key that can reference any referenceable object. We call our system Needle.
Content Warning
5/6
Content Warning