summaryrefslogtreecommitdiffstats
path: root/core/Command/Db
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-07-19 16:17:46 +0200
committerJoas Schilling <coding@schilljs.com>2017-07-25 12:49:15 +0200
commitb729cc2a02e3bb9a1010b6dee27292d34c2ba8a4 (patch)
treed3d22f0b1c7f595a0be18d01d05b7c9a8a6993c5 /core/Command/Db
parent087138f2280a95ed677be82d1420e32793227cd7 (diff)
downloadnextcloud-server-b729cc2a02e3bb9a1010b6dee27292d34c2ba8a4.tar.gz
nextcloud-server-b729cc2a02e3bb9a1010b6dee27292d34c2ba8a4.zip
Add *lob support for all tables
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command/Db')
-rw-r--r--core/Command/Db/ConvertType.php29
1 files changed, 15 insertions, 14 deletions
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php
index 81b2988b9d0..a7839522934 100644
--- a/core/Command/Db/ConvertType.php
+++ b/core/Command/Db/ConvertType.php
@@ -30,6 +30,7 @@ namespace OC\Core\Command\Db;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Table;
+use Doctrine\DBAL\Types\Type;
use OC\DB\MigrationService;
use OCP\DB\QueryBuilder\IQueryBuilder;
use \OCP\IConfig;
@@ -353,7 +354,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
}
foreach ($row as $key => $value) {
- $type = $this->getColumnType($table->getName(), $key);
+ $type = $this->getColumnType($table, $key);
if ($type !== false) {
$insertQuery->setParameter($key, $value, $type);
} else {
@@ -367,24 +368,24 @@ class ConvertType extends Command implements CompletionAwareInterface {
$progress->finish();
}
- protected function getColumnType($table, $column) {
- if (isset($this->columnTypes[$table][$column])) {
- return $this->columnTypes[$table][$column];
+ protected function getColumnType(Table $table, $columnName) {
+ $tableName = $table->getName();
+ if (isset($this->columnTypes[$tableName][$columnName])) {
+ return $this->columnTypes[$tableName][$columnName];
}
- $prefix = $this->config->getSystemValue('dbtableprefix', 'oc_');
- $this->columnTypes[$table][$column] = false;
+ $type = $table->getColumn($columnName)->getType()->getName();
- if ($table === $prefix . 'cards' && $column === 'carddata') {
- $this->columnTypes[$table][$column] = IQueryBuilder::PARAM_LOB;
- } else if ($column === 'calendardata') {
- if ($table === $prefix . 'calendarobjects' ||
- $table === $prefix . 'schedulingobjects') {
- $this->columnTypes[$table][$column] = IQueryBuilder::PARAM_LOB;
- }
+ switch ($type) {
+ case Type::BLOB:
+ case Type::TEXT:
+ $this->columnTypes[$tableName][$columnName] = IQueryBuilder::PARAM_LOB;
+ break;
+ default:
+ $this->columnTypes[$tableName][$columnName] = false;
}
- return $this->columnTypes[$table][$column];
+ return $this->columnTypes[$tableName][$columnName];
}
protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {