diff options
Diffstat (limited to 'lib/private/DB/SQLiteMigrator.php')
-rw-r--r-- | lib/private/DB/SQLiteMigrator.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/DB/SQLiteMigrator.php b/lib/private/DB/SQLiteMigrator.php index 8ea32581011..837a3a2987f 100644 --- a/lib/private/DB/SQLiteMigrator.php +++ b/lib/private/DB/SQLiteMigrator.php @@ -26,6 +26,8 @@ namespace OC\DB; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Schema\Schema; +use Doctrine\DBAL\Types\BigIntType; +use Doctrine\DBAL\Types\Type; class SQLiteMigrator extends Migrator { @@ -76,6 +78,15 @@ class SQLiteMigrator extends Migrator { $platform->registerDoctrineTypeMapping('smallint unsigned', 'integer'); $platform->registerDoctrineTypeMapping('varchar ', 'string'); + // with sqlite autoincrement columns is of type integer + foreach ($targetSchema->getTables() as $table) { + foreach ($table->getColumns() as $column) { + if ($column->getType() instanceof BigIntType && $column->getAutoincrement()) { + $column->setType(Type::getType('integer')); + } + } + } + return parent::getDiff($targetSchema, $connection); } } |