closure_tree icon indicating copy to clipboard operation
closure_tree copied to clipboard

Add an option `database_type`

Open markusherzog opened this issue 6 years ago • 4 comments

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

markusherzog avatar Nov 16 '18 13:11 markusherzog

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

kbrock avatar Sep 10 '19 17:09 kbrock

@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 avatar Jan 10 '21 18:01 n-rodriguez

@n-rodriguez sure, i've rebased my branch now (sorry for the delay ;-))

markusherzog avatar May 04 '21 09:05 markusherzog

This will be figured out in runtime.

We finally dropped the support to version that caused error.

seuros avatar Jan 19 '24 02:01 seuros