Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 588 forks source link

Migrate SQL Server does not work #127

Open carlosfiori opened 7 years ago

carlosfiori commented 7 years ago

When trying to generate the schema from a SQL Server database the following error is returned:

[PDOException] SQLSTATE [IM001]: Driver does not support this function: driver does not support that attribute

michastubi commented 4 years ago

Hi, maybe a little bit late. But I ran into the same issue. Maybe someone else can profit form this answer. I fixed it quickly, through adding following line to \laravel5.6\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php at line 52

     /**
     * {@inheritdoc}
     */
    public function getServerVersion()
    {
        return "15.0.2070.41"; //<-- the SQL Server Verison
        return PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
    }

How to find your Server Version: https://support.jetglobal.com/hc/en-us/articles/218952288-Locating-SQL-Server-Versions

Maybe someone else finds a better solution. I think it has something to do with this two bug reports; https://github.com/Microsoft/msphpsql/issues/733 https://github.com/microsoft/msphpsql/issues/756 I first tried to solve this through updating unixODBC: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#ubuntu But this didn´t worked for me. But I just needed to generate the files. And with the above provided solution it worked for me! :)