Comments (6)
@sfusato are you setting the FK type in your module? https://github.com/coryodaniel/arbor/blob/master/README.md#options
Can you open a separate ticket and include a minimal example of the module and query that fails
from arbor.
Can you provide the elixir syntax that generated that?
from arbor.
just like this:
my_comment
|> Comment.descendants
|> Repo.all
from arbor.
I can't reproduce this, can you make a minimal example in a github that does and share it?
from arbor.
I have a different error for the same descendants
function:
Ecto.Query.CastError at GET /admin/menu/3/nodes
lib/nemo/menus/nodes/menu_node.ex:1: value `3` in `where` cannot be cast to type :binary_id in query:
from m0 in Nemo.Menus.Nodes.MenuNode,
where: m0.id in fragment("WITH RECURSIVE menu_nodes_tree AS (\n SELECT id,\n 0 AS depth\n FROM menu_nodes\n WHERE parent_id = ?\nUNION ALL\n SELECT menu_nodes.id,\n menu_nodes_tree.depth + 1\n FROM menu_nodes\n JOIN menu_nodes_tree\n ON menu_nodes.parent_id = menu_nodes_tree.id\n WHERE menu_nodes_tree.depth + 1 < ?\n)\nSELECT id FROM menu_nodes_tree\n", type(^3, :binary_id), type(^2147483647, :integer)),
select: m0
My schema uses the default :id
type for primary keys/foreign keys. Not sure if that has anything to do with it.
from arbor.
You are right. The issue was because of my lack of attention. I didn't modify/update the config options I copy-pasted from the documentation to use :id
in my case:
use Arbor.Tree, foreign_key_type: :binary_id
Thank you for the swift reply. I apologize for this.
from arbor.
Related Issues (20)
- Move subtree
- leafs/0
- Depths selector on descendants and subtree
- Document tree macros
- Move each query/operation into its own module
- Support for multiple parents
- Passing a root element to siblings raises casting error
- Slow Arbor.Tree.ancestor/1 performance w/ table over 1mm records HOT 1
- function instead of macro HOT 1
- Support ltree in postgres HOT 1
- parent_key and parent_key_type not registering
- Support for preloading associations? HOT 1
- Support dynamic switching of schema prefixes HOT 15
- prefix not found in struct_fields[:__meta__].source HOT 1
- Hierarchy Descendants return type option
- ancestors error HOT 2
- Recommanded way of retrieving all roots along with their descendents(n)?
- Ecto struct_fields HOT 3
- initial use UndefinedFunctionError
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arbor.