On Monday, September 2, 2019 at 2:49:26 AM UTC-7, D-lev wrote:
>
> Hi,
> There is a mention of "The DB convention"
> <https://github.com/jeremyevans/sequel#the-db-convention>, and I'm
> missing a starting point of using two different database (one for business
> logic and the other for auditing)
> I want to keep those connection open for both, looking for a way to use
> 'DB' for main database and 'DB_AUDIT' for alternative one.
> It could be great if 'DB' was a hash of Database connection instances so I
> wouldn't have to add global constants for each new database.
>
> Am I missing something simpler?
>
DB is the convention for a single database. If you need to use multiple
databases, you can certainly do it the way you want:
DB = {}
DB[:main] = Sequel.connect('...')
DB[:audit] = Sequel.connect('...')
If the databases have the same schema, you could look into using Sequel's
sharding support:
http://sequel.jeremyevans.net/rdoc/files/doc/sharding_rdoc.html
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/1f0051fc-287d-4132-a2d6-191fe4cf6b90%40googlegroups.com.