1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace OCA\FaceRecognition\Migration; |
||
6 | |||
7 | use Closure; |
||
8 | use OCP\DB\ISchemaWrapper; |
||
9 | use OCP\IDBConnection; |
||
10 | use OCP\Migration\IOutput; |
||
11 | use OCP\Migration\SimpleMigrationStep; |
||
12 | |||
13 | /** |
||
14 | * Auto-generated migration step: Please modify to your needs! |
||
15 | */ |
||
16 | class Version000604Date20200908224225 extends SimpleMigrationStep { |
||
17 | |||
18 | /** @var IDBConnection */ |
||
19 | protected $connection; |
||
20 | |||
21 | public function __construct(IDBConnection $connection) { |
||
22 | $this->connection = $connection; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * @param IOutput $output |
||
27 | * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
||
28 | * @param array $options |
||
29 | * @return null|ISchemaWrapper |
||
30 | */ |
||
31 | public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
||
32 | /** @var ISchemaWrapper $schema */ |
||
33 | $schema = $schemaClosure(); |
||
34 | |||
35 | $personsTable = $schema->getTable('facerecog_persons'); |
||
36 | $personsTable->changeColumn('name', [ |
||
37 | 'notnull' => false, |
||
38 | 'default' => null, |
||
39 | ]); |
||
40 | |||
41 | return $schema; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param IOutput $output |
||
46 | * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
||
47 | * @param array $options |
||
48 | * |
||
49 | * @return void |
||
50 | */ |
||
51 | public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
||
52 | $query = $this->connection->getQueryBuilder(); |
||
53 | $query->update('facerecog_persons') |
||
54 | ->set('name', $query->createNamedParameter(null)) |
||
55 | ->where($query->expr()->iLike('name', $query->createNamedParameter('New person %'))); |
||
56 | $query->execute(); |
||
0 ignored issues
–
show
|
|||
57 | } |
||
58 | |||
59 | } |
||
60 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.