Skip to content

Commit

Permalink
Fix usage of DBAL types
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Jan 5, 2021
1 parent 552c1dc commit 793a905
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion lib/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function count(INotification $notification): int {
$this->sqlWhere($sql, $notification);

$statement = $sql->execute();
$count = (int) $statement->fetchColumn();
$count = (int) $statement->fetchOne();
$statement->closeCursor();

return $count;
Expand Down
44 changes: 22 additions & 22 deletions lib/Migration/Version2004Date20190107135757.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace OCA\Notifications\Migration;

use Closure;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
Expand All @@ -43,55 +43,55 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

if (!$schema->hasTable('notifications')) {
$table = $schema->createTable('notifications');
$table->addColumn('notification_id', Type::INTEGER, [
$table->addColumn('notification_id', Types::INTEGER, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('app', Type::STRING, [
$table->addColumn('app', Types::STRING, [
'notnull' => true,
'length' => 32,
]);
$table->addColumn('user', Type::STRING, [
$table->addColumn('user', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('timestamp', Type::INTEGER, [
$table->addColumn('timestamp', Types::INTEGER, [
'notnull' => true,
'length' => 4,
'default' => 0,
]);
$table->addColumn('object_type', Type::STRING, [
$table->addColumn('object_type', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('object_id', Type::STRING, [
$table->addColumn('object_id', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('subject', Type::STRING, [
$table->addColumn('subject', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('subject_parameters', Type::TEXT, [
$table->addColumn('subject_parameters', Types::TEXT, [
'notnull' => false,
]);
$table->addColumn('message', Type::STRING, [
$table->addColumn('message', Types::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('message_parameters', Type::TEXT, [
$table->addColumn('message_parameters', Types::TEXT, [
'notnull' => false,
]);
$table->addColumn('link', Type::STRING, [
$table->addColumn('link', Types::STRING, [
'notnull' => false,
'length' => 4000,
]);
$table->addColumn('icon', Type::STRING, [
$table->addColumn('icon', Types::STRING, [
'notnull' => false,
'length' => 4000,
]);
$table->addColumn('actions', Type::TEXT, [
$table->addColumn('actions', Types::TEXT, [
'notnull' => false,
]);
$table->setPrimaryKey(['notification_id']);
Expand All @@ -103,36 +103,36 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

if (!$schema->hasTable('notifications_pushtokens')) {
$table = $schema->createTable('notifications_pushtokens');
$table->addColumn('uid', Type::STRING, [
$table->addColumn('uid', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('token', Type::INTEGER, [
$table->addColumn('token', Types::INTEGER, [
'notnull' => true,
'length' => 4,
'default' => 0,
]);
$table->addColumn('deviceidentifier', Type::STRING, [
$table->addColumn('deviceidentifier', Types::STRING, [
'notnull' => true,
'length' => 128,
]);
$table->addColumn('devicepublickey', Type::STRING, [
$table->addColumn('devicepublickey', Types::STRING, [
'notnull' => true,
'length' => 512,
]);
$table->addColumn('devicepublickeyhash', Type::STRING, [
$table->addColumn('devicepublickeyhash', Types::STRING, [
'notnull' => true,
'length' => 128,
]);
$table->addColumn('pushtokenhash', Type::STRING, [
$table->addColumn('pushtokenhash', Types::STRING, [
'notnull' => true,
'length' => 128,
]);
$table->addColumn('proxyserver', Type::STRING, [
$table->addColumn('proxyserver', Types::STRING, [
'notnull' => true,
'length' => 256,
]);
$table->addColumn('apptype', Type::STRING, [
$table->addColumn('apptype', Types::STRING, [
'notnull' => true,
'length' => 32,
'default' => 'unknown',
Expand Down
1 change: 0 additions & 1 deletion lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf
$devices = $this->getDevicesForUser($notification->getUser());
if (empty($devices)) {
$this->printInfo('No devices found for user');
return;
}

$this->printInfo('Trying to push to ' . count($devices) . ' devices');
Expand Down

0 comments on commit 793a905

Please sign in to comment.