CakePHP 5.x - MS SQL Server - Migration Error

Hi to all, me again…

I have succesfully configured db connection to MS-SQL and it’s working…
Adding tables manually works well also…
Now I want to use migrations:

I have create migrations with “bin\cake bake migration” command, but when I run the command “bin\cake migrations migrate” I have an error:

2024-08-21 14:38:56 error: [InvalidArgumentException] Could not infer database type from driver in C:\dev\web\cms\vendor\cakephp\migrations\src\ConfigurationTrait.php on line 232

Any suggestions?
The DB server is MS-SQL Server.

Thanks for help and patience…

Whatever you have configured as your datasource doesn’t contain a valid driver config.

Try setting

'driver' => \Cake\Database\Driver\Sqlserver::class,

in your config if you are on MS-SQL

Actually my app_local.php si configured as is:

            'encoding' => PDO::SQLSRV_ENCODING_UTF8,
            'driver' => Sqlserver::class,
            //'port' => 'non_standard_port_number',
            'username' => 'cakePHP',
            'password' => 'secret',
            'database' => 'cake_cms',

isn’t that correct?

Now with that correction migrations and seeding seems works, but launching

bin/cake bake model articles

return me now that error:

2024-08-22 08:05:55 error: [Cake\Database\Exception\DatabaseException] Cannot describe articles. It has 0 columns. in C:\dev\web\cms\vendor\cakephp\cakephp\src\Database\Schema\Collection.php on line 118

well, does you database have an articles table :smiley:

Also make sure to clear the ORM cache via

bin/cake cache clear_all