aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-12-04 18:34:23 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-12-05 00:35:09 +0100
commitf57e334f8395e3b5c046b6d28480d798453e4866 (patch)
treee92b05aa4463019fd29be7baaffe6037585bd51a /core/Command
parentd3b4127164cc324b8835814264b6dd72d3773113 (diff)
downloadnextcloud-server-f57e334f8395e3b5c046b6d28480d798453e4866.tar.gz
nextcloud-server-f57e334f8395e3b5c046b6d28480d798453e4866.zip
Fix bigint conversion on SQLite
* on SQLite primary keys can't be bigint - see https://stackoverflow.com/a/18835967/520507 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/Db/ConvertFilecacheBigInt.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php
index eab64660ac4..a1e3ba69f98 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;
@@ -63,6 +64,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,7 +77,9 @@ 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]);