Skip to content

Commit

Permalink
Set empty authtoken names to 'none' #30792
Browse files Browse the repository at this point in the history
  • Loading branch information
IljaN committed Mar 22, 2018
1 parent 38841bb commit cbdc4be
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions core/Migrations/Version20180319102121.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace OC\Migrations;

use OCP\IDBConnection;
use OCP\Migration\ISqlMigration;

/**
* Sets empty authtoken names to '(none)'
* https://github.com/owncloud/core/issues/30792
*/
class Version20180319102121 implements ISqlMigration {

public function sql(IDBConnection $connection) {
$q = $connection->getQueryBuilder();
$q->update('authtoken')
->set('name', '(none)')
->where($q->expr()->eq('name', $q->expr()->literal('')))
->orWhere($q->expr()->isNull('name'));

return [$q->getSQL()];

}
}

0 comments on commit cbdc4be

Please sign in to comment.