diff --git a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php index a57ba916500..30c3e4f584b 100644 --- a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php +++ b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php @@ -30,7 +30,7 @@ class Version1011Date20201120125158 extends SimpleMigrationStep { if ($schema->hasTable('federated_reshares')) { $table = $schema->getTable('federated_reshares'); $remoteIdColumn = $table->getColumn('remote_id'); - if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Types::STRING) { + if ($remoteIdColumn && Type::lookupName($remoteIdColumn->getType()) !== Types::STRING) { $remoteIdColumn->setNotnull(false); $remoteIdColumn->setType(Type::getType(Types::STRING)); $remoteIdColumn->setOptions(['length' => 255]); diff --git a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php index 533612a887e..5530a3ad8ab 100644 --- a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php +++ b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php @@ -88,7 +88,7 @@ class Version11300Date20201120141438 extends SimpleMigrationStep { } else { $table = $schema->getTable('share_external'); $remoteIdColumn = $table->getColumn('remote_id'); - if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Types::STRING) { + if ($remoteIdColumn && Type::lookupName($remoteIdColumn->getType()) !== Types::STRING) { $remoteIdColumn->setNotnull(false); $remoteIdColumn->setType(Type::getType(Types::STRING)); $remoteIdColumn->setOptions(['length' => 255]); diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 7d0d0c4eabe..f44671a2293 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1268,11 +1268,6 @@ - - - - - @@ -1709,11 +1704,6 @@ - - - - - getShareOwner() . '/files')]]> @@ -3054,19 +3044,8 @@ appConfig->getValues($app, false)]]> - - - - - - - - - - - diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 0d96d139701..47111063582 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -70,7 +70,7 @@ class ConvertFilecacheBigInt extends Command { $column = $table->getColumn($columnName); $isAutoIncrement = $column->getAutoincrement(); $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; - if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { + if (Type::lookupName($column->getType()) !== Types::BIGINT && !$isAutoIncrementOnSqlite) { $column->setType(Type::getType(Types::BIGINT)); $column->setOptions(['length' => 20]); diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index e09f803f3c8..2c74e9e517f 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -10,6 +10,7 @@ namespace OC\Core\Command\Db; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractAsset; use Doctrine\DBAL\Schema\Table; +use Doctrine\DBAL\Types\Type; use OC\DB\Connection; use OC\DB\ConnectionFactory; use OC\DB\MigrationService; @@ -379,7 +380,7 @@ class ConvertType extends Command implements CompletionAwareInterface { return $this->columnTypes[$tableName][$columnName]; } - $type = $table->getColumn($columnName)->getType()->getName(); + $type = Type::lookupName($table->getColumn($columnName)->getType()); switch ($type) { case Types::BLOB: diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index c7396ae4b84..be2826871bb 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; +use Doctrine\DBAL\Types\Type; use OC\App\InfoParser; use OC\Migration\SimpleOutput; use OCP\App\IAppManager; @@ -579,7 +580,7 @@ class MigrationService { if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { // Oracle doesn't support boolean column with non-null value - if ($thing->getNotnull() && $thing->getType()->getName() === Types::BOOLEAN) { + if ($thing->getNotnull() && Type::lookupName($thing->getType()) === Types::BOOLEAN) { $thing->setNotnull(false); } } @@ -591,8 +592,8 @@ class MigrationService { // If the column was just created OR the length changed OR the type changed // we will NOT detect invalid length if the column is not modified - if (($sourceColumn === null || $sourceColumn->getLength() !== $thing->getLength() || $sourceColumn->getType()->getName() !== Types::STRING) - && $thing->getLength() > 4000 && $thing->getType()->getName() === Types::STRING) { + if (($sourceColumn === null || $sourceColumn->getLength() !== $thing->getLength() || Type::lookupName($sourceColumn->getType()) !== Types::STRING) + && $thing->getLength() > 4000 && Type::lookupName($thing->getType()) === Types::STRING) { throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type String, but exceeding the 4.000 length limit.'); } } diff --git a/lib/public/Migration/BigIntMigration.php b/lib/public/Migration/BigIntMigration.php index 0fa7e559f79..a2fda697cbc 100644 --- a/lib/public/Migration/BigIntMigration.php +++ b/lib/public/Migration/BigIntMigration.php @@ -39,7 +39,7 @@ abstract class BigIntMigration extends SimpleMigrationStep { foreach ($columns as $columnName) { $column = $table->getColumn($columnName); - if ($column->getType()->getName() !== Types::BIGINT) { + if (Type::lookupName($column->getType()) !== Types::BIGINT) { $column->setType(Type::getType(Types::BIGINT)); $column->setOptions(['length' => 20]); }