# CakePHP 5.x - MS SQL Server - Migration Error

**URL:** <https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191>\
**Category:** Need Help\
**Tags:** help\
**Created:** [August 21, 2024, 2:48pm UTC](https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191 "2024-08-21T14:48:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndyDTK](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@AndyDTK](https://discourse.cakephp.org/u/AndyDTK)\
**Post date:** [August 21, 2024, 2:48pm UTC](https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191/1 "2024-08-21T14:48:39Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [August 21, 2024, 6:38pm UTC](https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191/2 "2024-08-21T18:38:52Z")

</div>

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

Try setting

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

```

in your config if you are on MS-SQL

---

<div class="post-metadata">

**Author:** ![AndyDTK](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@AndyDTK](https://discourse.cakephp.org/u/AndyDTK)\
**Post date:** [August 22, 2024, 7:25am UTC](https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191/3 "2024-08-22T07:25:50Z")

</div>

Actually my app\_local.php si configured as is:

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

```

isn’t that correct?

---

<div class="post-metadata">

**Author:** ![AndyDTK](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@AndyDTK](https://discourse.cakephp.org/u/AndyDTK)\
**Post date:** [August 22, 2024, 8:18am UTC](https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191/4 "2024-08-22T08:18:07Z")

</div>

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

```auto
bin/cake bake model articles

```

return me now that error:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [August 22, 2024, 8:45am UTC](https://discourse.cakephp.org/t/cakephp-5-x-ms-sql-server-migration-error/12191/5 "2024-08-22T08:45:53Z")

</div>

well, does you database have an `articles` table 😃

Also make sure to clear the ORM cache via

```auto
bin/cake cache clear_all

```
