I am trying to dynamically create database for different users. (every user will have their own database server, so don't ask why I am not using a single database for all users) To do that, I have a default database storing all the connection information. I will need to:
- Create a new database and run all migration files on new user registration.
- Run new migration files on all database recorded in this default database when there is update in schema.
Is there a way I can dynamically set the database connection of the migration file based on the information I have on the default database?
P.S. For "dynamically set the database connection", I am NOT meaning the normal setting as you do in controller or class. I expect something that would at least create migration table in the target database and be able to self-detect what migration file to run.