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 9947d69
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions core/Migrations/Version20180319102121.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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', $q->expr()->literal('(none)'))
->where($q->expr()->eq('name', $q->expr()->literal('')))
->orWhere($q->expr()->isNull('name'));
return [$q->getSQL()];
}
}

0 comments on commit 9947d69

Please sign in to comment.