davedevelopment / phpmig

Simple migrations system for php
Other
568 stars 92 forks source link

Add pdo_dblib support #120

Closed imunew closed 7 years ago

imunew commented 7 years ago

environment

$ php -i | grep dblib
/etc/php.d/30-pdo_dblib.ini,
PDO drivers => dblib, mysql, sqlite
pdo_dblib

before

$ bin/phpmig generate Example

  [PDOException]                                                                                                                         
  SQLSTATE[HY000]: General error: 2812 General SQL Server error: Check messages from the SQL Server [2812] (severity 16) [SHOW TABLES;]  
// phpmig/src/Phpmig/Adapter/PDO/Sql.php
            case 'mysql':
            default:
                $queries = array(

                        'fetchAll'     => "SELECT `version` FROM {$this->quotedTableName()} ORDER BY `version` ASC",

                        'up'           => "INSERT into {$this->quotedTableName()} set version = :version",

                        'down'         => "DELETE from {$this->quotedTableName()} where version = :version",

                        'hasSchema'    => "SHOW TABLES;",

                        'createSchema' => "CREATE TABLE {$this->quotedTableName()} (`version` VARCHAR(255) NOT NULL);",

                    );
                break;

after

$ bin/phpmig generate Example
+f ./migrations/20170106114835_Example.php

reference

davedevelopment commented 7 years ago

Thanks!