`parent_id` as zero
nolleto opened this issue · 1 comments
nolleto commented
Hi, in my current project I'm trying to add this gem and work very well. I just found something annoying that in our parent_id column (that in this project is parent_widget_id) is a required integer
create_table "widgets", id: :serial, force: :cascade do |t|
t.integer "parent_widget_id", default: 0
...
endSo, I was wondering if it is possible to set the root node with 0 value instead of nil?
Just some extra information, this is a really huge project and it's a little hard to find all parent_widget_id logic where is treating the root as 0 then, update the table to convert it to a nullable value to accept nil can lead to some headaches. 😓
seuros commented
having 0 in the field break database integrity. use foreign keys to avoid having wrong structure.