@@ -28,30 +28,30 @@ |
||
| 28 | 28 | use Doctrine\DBAL\Types\Type; |
| 29 | 29 | |
| 30 | 30 | class SQLiteMigrator extends Migrator { |
| 31 | - /** |
|
| 32 | - * @param Schema $targetSchema |
|
| 33 | - * @param \Doctrine\DBAL\Connection $connection |
|
| 34 | - * @return \Doctrine\DBAL\Schema\SchemaDiff |
|
| 35 | - */ |
|
| 36 | - protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) { |
|
| 37 | - $platform = $connection->getDatabasePlatform(); |
|
| 38 | - $platform->registerDoctrineTypeMapping('tinyint unsigned', 'integer'); |
|
| 39 | - $platform->registerDoctrineTypeMapping('smallint unsigned', 'integer'); |
|
| 40 | - $platform->registerDoctrineTypeMapping('varchar ', 'string'); |
|
| 31 | + /** |
|
| 32 | + * @param Schema $targetSchema |
|
| 33 | + * @param \Doctrine\DBAL\Connection $connection |
|
| 34 | + * @return \Doctrine\DBAL\Schema\SchemaDiff |
|
| 35 | + */ |
|
| 36 | + protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) { |
|
| 37 | + $platform = $connection->getDatabasePlatform(); |
|
| 38 | + $platform->registerDoctrineTypeMapping('tinyint unsigned', 'integer'); |
|
| 39 | + $platform->registerDoctrineTypeMapping('smallint unsigned', 'integer'); |
|
| 40 | + $platform->registerDoctrineTypeMapping('varchar ', 'string'); |
|
| 41 | 41 | |
| 42 | - foreach ($targetSchema->getTables() as $table) { |
|
| 43 | - foreach ($table->getColumns() as $column) { |
|
| 44 | - // column comments are not supported on SQLite |
|
| 45 | - if ($column->getComment() !== null) { |
|
| 46 | - $column->setComment(null); |
|
| 47 | - } |
|
| 48 | - // with sqlite autoincrement columns is of type integer |
|
| 49 | - if ($column->getType() instanceof BigIntType && $column->getAutoincrement()) { |
|
| 50 | - $column->setType(Type::getType('integer')); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 42 | + foreach ($targetSchema->getTables() as $table) { |
|
| 43 | + foreach ($table->getColumns() as $column) { |
|
| 44 | + // column comments are not supported on SQLite |
|
| 45 | + if ($column->getComment() !== null) { |
|
| 46 | + $column->setComment(null); |
|
| 47 | + } |
|
| 48 | + // with sqlite autoincrement columns is of type integer |
|
| 49 | + if ($column->getType() instanceof BigIntType && $column->getAutoincrement()) { |
|
| 50 | + $column->setType(Type::getType('integer')); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return parent::getDiff($targetSchema, $connection); |
|
| 56 | - } |
|
| 55 | + return parent::getDiff($targetSchema, $connection); |
|
| 56 | + } |
|
| 57 | 57 | } |