Welcome Guest, Not a member yet? Register   Sign In
Support multiple databases for db:table
#1

Hi,

I'm mostly working over multiple databases so what I miss is the
Code:
db:table 
command that support multiple connections. It works in application, in migrations but not over
Code:
spark db:table
. I guess it could be just optional argument that determine the configured connection.

I simply did 
PHP Code:
    /**
    * The Command's Usage
    *
    * @var string
    */
    protected $usage = <<<'EOL'
    db:extension [options]

      Examples:
        db:extension --db default
    EOL; 

in custom command to my purposes but it could be system feature.
In case that nodoby (as I supose) wants to fill --db argument the default will be the value as I did in my purpose
PHP Code:
    /**
    * Actually execute a command.
    *
    * @param array $params
    */
    public function run(array $params)
    {
        $dbGroup $params['db'] ?? 'default';

        $db = \Config\Database::connect($dbGroup);
.... 
Reply


Messages In This Thread
Support multiple databases for db:table - by marekmosna - 07-01-2023, 12:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB