diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-12-05 18:52:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-05 18:52:56 +0100 |
commit | fe5813783bf09905728ed1a5a7f158f56659b1b5 (patch) | |
tree | 541b7f20135ad28441e1dad30b2a234b05dff4db /core | |
parent | 5e44699139d59e66d65586adc3da8e4ee1c4ebde (diff) | |
parent | 17b2827bbf20691dc59721a9c61a225c5fb4e0de (diff) | |
download | nextcloud-server-fe5813783bf09905728ed1a5a7f158f56659b1b5.tar.gz nextcloud-server-fe5813783bf09905728ed1a5a7f158f56659b1b5.zip |
Merge pull request #12824 from nextcloud/feature/12763/add-setup-check-for-bigint-conversion
Add setup check for pending bigint conversion
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/Db/ConvertFilecacheBigInt.php | 13 | ||||
-rw-r--r-- | core/js/setupchecks.js | 16 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 39 |
3 files changed, 53 insertions, 15 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()) { diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 222b12b8f40..343b676080a 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -337,6 +337,22 @@ type: OC.SetupChecks.MESSAGE_TYPE_INFO }) } + if (data.pendingBigIntConversionColumns.length > 0) { + var listOfPendingBigIntConversionColumns = ""; + data.pendingBigIntConversionColumns.forEach(function(element){ + listOfPendingBigIntConversionColumns += "<li>" + element + "</li>"; + }); + messages.push({ + msg: t( + 'core', + 'Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running \'occ db:convert-filecache-bigint\' those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read <a target="_blank" rel="noreferrer noopener" href="{docLink}">the documentation page about this</a>.', + { + docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-bigint-conversion'), + } + ) + "<ul>" + listOfPendingBigIntConversionColumns + "</ul>", + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }) + } if (data.isSqliteUsed) { messages.push({ msg: t( diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index b6b127bae53..05178a3e5cc 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -211,7 +211,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -261,7 +262,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -312,7 +314,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -361,7 +364,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -408,7 +412,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -457,7 +462,8 @@ describe('OC.SetupChecks tests', function() { appDirsWithDifferentOwner: [ '/some/path' ], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -504,7 +510,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -551,7 +558,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -596,9 +604,10 @@ describe('OC.SetupChecks tests', function() { cronInfo: { diffInSeconds: 0 }, + isMemoryLimitSufficient: false, appDirsWithDifferentOwner: [], recommendedPHPModules: [], - isMemoryLimitSufficient: false + pendingBigIntConversionColumns: [] }) ); @@ -666,7 +675,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -714,7 +724,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -762,7 +773,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); @@ -810,7 +822,8 @@ describe('OC.SetupChecks tests', function() { }, isMemoryLimitSufficient: true, appDirsWithDifferentOwner: [], - recommendedPHPModules: [] + recommendedPHPModules: [], + pendingBigIntConversionColumns: [] }) ); |