diff options
Diffstat (limited to 'core/Command/Db/ConvertFilecacheBigInt.php')
-rw-r--r-- | core/Command/Db/ConvertFilecacheBigInt.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 5960b7aa9dd..93ada896327 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -23,6 +23,7 @@ namespace OC\Core\Command\Db; +use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Types\Type; use OC\DB\SchemaWrapper; use OCP\IDBConnection; @@ -51,6 +52,7 @@ class ConvertFilecacheBigInt extends Command { } protected function getColumnsByTable() { + // also update in CheckSetupController::hasBigIntConversionPendingColumns() return [ 'activity' => ['activity_id', 'object_id'], 'activity_mq' => ['mail_id'], @@ -63,6 +65,7 @@ class ConvertFilecacheBigInt extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $schema = new SchemaWrapper($this->connection); + $isSqlite = $this->connection->getDatabasePlatform() instanceof SqlitePlatform; $updates = []; $tables = $this->getColumnsByTable(); @@ -75,11 +78,13 @@ class ConvertFilecacheBigInt extends Command { foreach ($columns as $columnName) { $column = $table->getColumn($columnName); - if ($column->getType()->getName() !== Type::BIGINT) { + $isAutoIncrement = $column->getAutoincrement(); + $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; + if ($column->getType()->getName() !== Type::BIGINT && !$isAutoIncrementOnSqlite) { $column->setType(Type::getType(Type::BIGINT)); $column->setOptions(['length' => 20]); - $updates[] = $tableName . '.' . $columnName; + $updates[] = '* ' . $tableName . '.' . $columnName; } } } @@ -89,6 +94,10 @@ class ConvertFilecacheBigInt extends Command { return 0; } + $output->writeln('<comment>Following columns will be updated:</comment>'); + $output->writeln(''); + $output->writeln($updates); + $output->writeln(''); $output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); if ($input->isInteractive()) { |