I'm trying to run a module migration and use its database config. I have a client module and its own database connection.
What I want is when I use php oil refine migrate --modules=client, will be used the client database's config instead of global. Is there a way to do that?
I will set the customer's database on runtime, I have been trying to set database config with \Config::set(), but without success. I did a workarround as the following:
Afaik there is no provision for per-module databases.
I wonder, if you say the name of the database is determined "at runtime", how a commandline migrate should determine it? If only because it doesn't have a session.
We only maintain one app that uses "per-client" databases, but those are stored in the (main) database.
From what I can see, the code creates the connection dynamically using
\DB::instance($clientname, $clientconfig);
and then uses it in the ORM models using set_connection().
I have a list of all databases. Running the app with multiples databases was a requirement of our client.
I'm using a tenant_id to determine what databases must be loaded. Such ID is grabbed using domain, in that way, I can identify what database to use. In this scenario using session solved the problem even this not being the best way.