Uh oh!
There was an error while loading. Please reload this page.
Fix spark migrate issue with -g option - #7846
Conversation
kenjis
commented
Aug 23, 2023
Thank you for sending PR! You must sign all commits with a valid GPG key. |
MGatner
left a comment
There was a problem hiding this comment.
Code looks good! Please address the merge blockers.
b637bbc to
13a870cComparerougevache
commented
Sep 2, 2023
Sorry team, I was on vacation, I've removed the unsigned commit. |
datamweb
commented
Sep 2, 2023
@filoboss Your commit is still unsigned. |
4ce8f5d to
3531d7bComparekenjis
commented
Sep 2, 2023
rougevache
commented
Sep 3, 2023
Ok, sorry, email author problem, this one is good. |
@filoboss Thank you for signing.
Why there's no default database configured? Should it fail if you don't have the default database? |
kenjis
commented
Sep 4, 2023
Coding style check failed. Fix it. |
If there is no default group in $ php spark migrate -g test1CodeIgniter v4.3.7 Command Line Tool - Server Time: 2023-09-04 02:08:22 UTC+00:00[InvalidArgumentException]default is not a valid database connection group.at SYSTEMPATH/Database/Config.php:69Backtrace: 1 SYSTEMPATH/Common.php:362 CodeIgniter\Database\Config::connect('default', true) 2 SYSTEMPATH/Database/MigrationRunner.php:151 db_connect(null) 3 SYSTEMPATH/Config/Services.php:415 CodeIgniter\Database\MigrationRunner()->__construct(null, null) 4 SYSTEMPATH/Config/BaseService.php:252 CodeIgniter\Config\Services::migrations(Object(Config\Migrations), null, false) 5 SYSTEMPATH/Config/BaseService.php:193 CodeIgniter\Config\BaseService::__callStatic('migrations', [...]) 6 SYSTEMPATH/Config/Services.php:410 CodeIgniter\Config\BaseService::getSharedInstance('migrations', null, null) 7 SYSTEMPATH/Config/BaseService.php:252 CodeIgniter\Config\Services::migrations() 8 SYSTEMPATH/Commands/Database/Migrate.php:69 CodeIgniter\Config\BaseService::__callStatic('migrations', []) 9 SYSTEMPATH/CLI/Commands.php:65 CodeIgniter\Commands\Database\Migrate()->run([...]) 10 SYSTEMPATH/CLI/Console.php:37 CodeIgniter\CLI\Commands()->run('migrate', [...]) 11 ROOTPATH/spark:97 CodeIgniter\CLI\Console()->run() |
kenjis
commented
Sep 4, 2023
I'm sure there is a bug round the |
kenjis
commented
Sep 11, 2023
We have update the description for |
qury
commented
Sep 12, 2023
Hi Guys, I run into a this problem as well. I have multiple database connections defined. The default is a read-only DB. For me the solution was to update the Now, i'm not sure if this is the right was to do this or if there are any other places to update, but as far as i can tell there is no other place besides the constructor in MigrationRunner where the database connection is set or where we allow to overwrite the db connection. |
kenjis
commented
Sep 12, 2023
@qury Your configuration is not supported by the CI4 DB migration. So you need to customize the migration for yourself. |



Description
Supersedes #7845
When performing a spark migrate with the -g option to use a different DBgroup other than the default, and when there's no default database configured, the migration fails. This is because
$this->ensureTable()is executed before$this->setGroup($group). I've simply moved$this->ensureTable()to execute after setting the group.Checklist: