diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index 7eec414e..8116eb9d 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -822,7 +822,13 @@ public function getDoctrineColumn($table, $column) */ public function getDoctrineSchemaManager() { - return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection()); + $connection = $this->getDoctrineConnection(); + + // Doctrine v2 expects one parameter while v3 expects two. 2nd will be ignored on v2... + return $this->getDoctrineDriver()->getSchemaManager( + $connection, + $connection->getDatabasePlatform() + ); } /** @@ -834,9 +840,14 @@ public function getDoctrineConnection() { $driver = $this->getDoctrineDriver(); - $data = array('pdo' => $this->pdo, 'dbname' => $this->getConfig('database')); - - return new DoctrineConnection($data, $driver); + return new DoctrineConnection([ + 'host' => $this->getConfig('host'), + 'port' => $this->getConfig('port'), + 'user' => $this->getConfig('username'), + 'password' => $this->getConfig('password'), + 'dbname' => $this->getDatabaseName(), + 'charset' => $this->getConfig('charset'), + ], $driver); } /** diff --git a/src/Illuminate/Database/MySqlConnection.php b/src/Illuminate/Database/MySqlConnection.php index ac1e9d11..42b73471 100755 --- a/src/Illuminate/Database/MySqlConnection.php +++ b/src/Illuminate/Database/MySqlConnection.php @@ -1,7 +1,7 @@ to, $column->getType(), $column->toArray()); - - $tableDiff->renamedColumns = array($command->from => $newColumn); + $tableDiff->renamedColumns = array( + $command->from => new Column($command->to, $column->getType(), self::getWritableColumnOptions($column)) + ); return $tableDiff; } + private static function getWritableColumnOptions(Column $column): array + { + return array_filter( + $column->toArray(), + fn (string $name) => method_exists($column, 'set'.$name), + ARRAY_FILTER_USE_KEY + ); + } + /** * Compile a foreign key command. * diff --git a/src/Illuminate/Database/SqlServerConnection.php b/src/Illuminate/Database/SqlServerConnection.php index fa0c4cd3..822f53c2 100755 --- a/src/Illuminate/Database/SqlServerConnection.php +++ b/src/Illuminate/Database/SqlServerConnection.php @@ -1,7 +1,7 @@