Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace OCA\Activity;

use Doctrine\DBAL\Platforms\MySQLPlatform;
use OCA\Activity\Filter\AllFilter;
use OCP\Activity\Exceptions\FilterNotFoundException;
use OCP\Activity\IEvent;
Expand Down Expand Up @@ -526,8 +525,7 @@ public function expire($expireDays = 365) {
* @psalm-param list<array{0: string, 1: mixed, 2?: string}> $conditions
*/
public function deleteActivities(array $conditions): void {
$platform = $this->connection->getDatabasePlatform();
if ($platform instanceof MySQLPlatform) {
if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_MYSQL) {
$this->logger->debug('Choosing chunked activity delete for MySQL/MariaDB', ['app' => 'activity']);
$this->deleteActivitiesForMySQL($conditions);
return;
Expand Down
42 changes: 21 additions & 21 deletions lib/Migration/Version2006Date20170808154933.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace OCA\Activity\Migration;

use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

Expand All @@ -32,55 +32,55 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
'notnull' => true,
'length' => 20,
]);
$table->addColumn('timestamp', 'integer', [
$table->addColumn('timestamp', Types::INTEGER, [
'notnull' => true,
'length' => 4,
'default' => 0,
]);
$table->addColumn('priority', 'integer', [
$table->addColumn('priority', Types::INTEGER, [
'notnull' => true,
'length' => 4,
'default' => 0,
]);
$table->addColumn('type', 'string', [
$table->addColumn('type', Types::STRING, [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('user', 'string', [
$table->addColumn('user', Types::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('affecteduser', 'string', [
$table->addColumn('affecteduser', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('app', 'string', [
$table->addColumn('app', Types::STRING, [
'notnull' => true,
'length' => 32,
]);
$table->addColumn('subject', 'string', [
$table->addColumn('subject', Types::STRING, [
'notnull' => true,
'length' => 255,
]);
$table->addColumn('subjectparams', 'text', [
$table->addColumn('subjectparams', Types::TEXT, [
'notnull' => true,
]);
$table->addColumn('message', 'string', [
$table->addColumn('message', Types::STRING, [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('messageparams', 'text', [
$table->addColumn('messageparams', Types::TEXT, [
'notnull' => false,
]);
$table->addColumn('file', 'string', [
$table->addColumn('file', Types::STRING, [
'notnull' => false,
'length' => 4000,
]);
$table->addColumn('link', 'string', [
$table->addColumn('link', Types::STRING, [
'notnull' => false,
'length' => 4000,
]);
$table->addColumn('object_type', 'string', [
$table->addColumn('object_type', Types::STRING, [
'notnull' => false,
'length' => 255,
]);
Expand All @@ -105,33 +105,33 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
'notnull' => true,
'length' => 20,
]);
$table->addColumn('amq_timestamp', 'integer', [
$table->addColumn('amq_timestamp', Types::INTEGER, [
'notnull' => true,
'length' => 4,
'default' => 0,
]);
$table->addColumn('amq_latest_send', 'integer', [
$table->addColumn('amq_latest_send', Types::INTEGER, [
'notnull' => true,
'length' => 4,
'default' => 0,
]);
$table->addColumn('amq_type', 'string', [
$table->addColumn('amq_type', Types::STRING, [
'notnull' => true,
'length' => 255,
]);
$table->addColumn('amq_affecteduser', 'string', [
$table->addColumn('amq_affecteduser', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('amq_appid', 'string', [
$table->addColumn('amq_appid', Types::STRING, [
'notnull' => true,
'length' => 255,
]);
$table->addColumn('amq_subject', 'string', [
$table->addColumn('amq_subject', Types::STRING, [
'notnull' => true,
'length' => 255,
]);
$table->addColumn('amq_subjectparams', 'text', [
$table->addColumn('amq_subjectparams', Types::TEXT, [
'notnull' => true,
]);
$table->setPrimaryKey(['mail_id']);
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version2006Date20170808155040.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Version2006Date20170808155040 extends SimpleMigrationStep {
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
* @throws \Doctrine\DBAL\Schema\SchemaException
* @throws \OCP\DB\Schema\SchemaException
* @since 13.0.0
*/
#[\Override]
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version2007Date20181107114613.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace OCA\Activity\Migration;

use Closure;
use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

Expand Down
4 changes: 2 additions & 2 deletions lib/Migration/Version2008Date20181011095117.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
namespace OCA\Activity\Migration;

use Closure;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Schema\SchemaException;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

Expand Down
8 changes: 4 additions & 4 deletions lib/Migration/Version2011Date20201006132544.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace OCA\Activity\Migration;

use Closure;
use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
Expand All @@ -37,14 +37,14 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$table = $schema->getTable('activity_mq');

$column = $table->getColumn('amq_appid');
$column->setType(Type::getType('string'));
$column->setType(Types::STRING);
$column->setNotnull(true);
$column->setLength(32);

$column = $table->getColumn('amq_subjectparams');
// Can't switch from Long to clob on Oracle, so we need an intermediate column
if ($column->getType() !== Type::getType('text')) {
$table->addColumn('amq_subjectparams2', 'text', [
if ($column->getType()->getName() !== Types::TEXT) {
$table->addColumn('amq_subjectparams2', Types::TEXT, [
'notnull' => false,
]);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Migration/Version2011Date20201006132545.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace OCA\Activity\Migration;

use Closure;
use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

Expand All @@ -28,7 +28,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

$table = $schema->getTable('activity_mq');
$column = $table->getColumn('amq_subjectparams');
if ($column->getType() !== Type::getType('text')) {
if ($column->getType()->getName() !== Types::TEXT) {
$table->dropColumn('amq_subjectparams');
return $schema;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Migration/Version2011Date20201006132546.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
Expand All @@ -35,7 +36,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

$table = $schema->getTable('activity_mq');
if (!$table->hasColumn('amq_subjectparams')) {
$table->addColumn('amq_subjectparams', 'text', [
$table->addColumn('amq_subjectparams', Types::TEXT, [
'notnull' => false,
]);
return $schema;
Expand Down
5 changes: 0 additions & 5 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
</UndefinedClass>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
<referencedClass name="Doctrine\DBAL\Platforms\AbstractPlatform" />
<referencedClass name="Doctrine\DBAL\Schema\Schema" />
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
<referencedClass name="OC\Files\View" />
<referencedClass name="OC\TagManager" />
<referencedClass name="OC\Hooks\Emitter" />
Expand Down
8 changes: 4 additions & 4 deletions tests/Migration/Version8000Date20260603120000Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

namespace OCA\Activity\Tests\Migration;

use Doctrine\DBAL\Schema\Table;
use OCA\Activity\Migration\Version8000Date20260603120000;
use OCA\Activity\Tests\TestCase;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Schema\ITable;
use OCP\Migration\IOutput;
use PHPUnit\Framework\MockObject\MockObject;

Expand All @@ -34,7 +34,7 @@ protected function setUp(): void {
* migration adds the covering composite index and drops the now-redundant one.
*/
public function testAddsCompositeIndexAndDropsRedundantOne(): void {
$table = $this->createMock(Table::class);
$table = $this->createMock(ITable::class);
$table->method('hasIndex')
->willReturnMap([
['amp_user_send', false],
Expand All @@ -58,7 +58,7 @@ public function testAddsCompositeIndexAndDropsRedundantOne(): void {
* must be a no-op so re-runs / fresh installs are not touched.
*/
public function testIsIdempotentWhenAlreadyMigrated(): void {
$table = $this->createMock(Table::class);
$table = $this->createMock(ITable::class);
$table->method('hasIndex')
->willReturnMap([
['amp_user_send', true],
Expand Down Expand Up @@ -91,7 +91,7 @@ public function testSkipsWhenTableIsMissing(): void {
$this->assertNull($result);
}

protected function getSchemaMock(Table&MockObject $table): ISchemaWrapper&MockObject {
protected function getSchemaMock(ITable&MockObject $table): ISchemaWrapper&MockObject {
$schema = $this->createMock(ISchemaWrapper::class);
$schema->method('hasTable')
->with('activity_mq')
Expand Down
Loading
Loading