closure_tree
closure_tree copied to clipboard
Add an option `database_type`
Problem: When using numeric_ordering: true
, closure_tree tries to find out the type of database during the initialization process. This can be problematic, for example when doing rails db:create
, in which case there is no database, yet. Another scenario is rails asssets:prcompile
in a Docker container that is being made for production, but it doesn't have access to the production database yet, because it isn't rolled out, yet.
Solution: I have added an option to specify the database_type manually. This option is only used then numeric_ordering is set to true
This relates to issue #264 and PR #306
This is nice. Detecting the database type in the code is a little problematic because it often leads to connecting to the database prematurely. Especially while loading the ruby classes into memory.
Alternatively, there is a case statement that needs to run every method call at runtime.
This seems like a reasonable compromise between auto configuration and optimization
@markusherzog can you please rebase your branch on master
?
@seuros I think it's the easiest way to handle Rails 6.1 multi DB. wdyt?
@n-rodriguez sure, i've rebased my branch now (sorry for the delay ;-))
This will be figured out in runtime.
We finally dropped the support to version that caused error.