Skip to content

Commit

Permalink
Merge pull request #30908 from owncloud/stable10_set_empty_authtoken_…
Browse files Browse the repository at this point in the history
…names

[stable10] Set empty authtoken names to 'none' #30792
  • Loading branch information
DeepDiver1975 authored Mar 26, 2018
2 parents 5bf9410 + 423912c commit 30d42ea
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 30d42ea

Please sign in to comment.