ClosureTree / closure_tree

Easily and efficiently make your ActiveRecord models support hierarchies
https://closuretree.github.io/closure_tree/
MIT License
1.84k stars 239 forks source link

support for integer order_column with not-null constraint #252

Open nruth opened 7 years ago

nruth commented 7 years ago

Currently I'm getting null values inserted, then I assume updated afterwards, which gets rejected by postgres if there is a not null constraint.

On removing the not-null constraint, I see created records being given positions (order_column) correctly, but I'd prefer not to remove the constraint.

Is there a way to improve this, or could it be documented that it's not supported & perhaps suggest something else like a deferred trigger and transactions in place of a not-null constraint?

mceachen commented 7 years ago

It seems absolutely reasonable for this to be supported.

Would you be willing to work on a PR? I'd be happy to review it.

nruth commented 7 years ago

Yes certainly, I will try to make time for this soon.

On 2 Mar 2017, at 06:33, Matthew McEachen notifications@github.com wrote:

It seems absolutely reasonable for this to be supported.

Would you be willing to work on a PR? I'd be happy to review it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

nruth commented 7 years ago

Quick update: I've asked a colleague to work on this. I'm aiming to review and send a PR within the next few weeks.

smoyte commented 6 years ago

Any updates here? I too would like to have this. Could contribute work if needed.