Rello /
analytics
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Analytics |
||
| 4 | * |
||
| 5 | * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello |
||
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
||
| 7 | */ |
||
| 8 | |||
| 9 | declare(strict_types=1); |
||
| 10 | |||
| 11 | namespace OCA\Analytics\Migration; |
||
| 12 | |||
| 13 | use Closure; |
||
| 14 | use Doctrine\DBAL\Types\Type; |
||
|
0 ignored issues
–
show
|
|||
| 15 | use OCP\DB\ISchemaWrapper; |
||
|
0 ignored issues
–
show
The type
OCP\DB\ISchemaWrapper was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | use OCP\DB\Types; |
||
|
0 ignored issues
–
show
The type
OCP\DB\Types was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 17 | use OCP\IDBConnection; |
||
|
0 ignored issues
–
show
The type
OCP\IDBConnection was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | use OCP\Migration\IOutput; |
||
|
0 ignored issues
–
show
The type
OCP\Migration\IOutput was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 19 | use OCP\Migration\SimpleMigrationStep; |
||
|
0 ignored issues
–
show
The type
OCP\Migration\SimpleMigrationStep was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | |||
| 21 | /** |
||
| 22 | * Auto-generated migration step: Please modify to your needs! |
||
| 23 | * sudo -u www-data php occ migrations:execute analytics 4012Date20231108180000 |
||
| 24 | */ |
||
| 25 | class Version4012Date20231108180000 extends SimpleMigrationStep |
||
| 26 | { |
||
| 27 | |||
| 28 | /** @var IDBConnection */ |
||
| 29 | private $connection; |
||
| 30 | |||
| 31 | public function __construct(IDBConnection $connection) |
||
| 32 | { |
||
| 33 | $this->connection = $connection; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param IOutput $output |
||
| 38 | * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
||
| 39 | * @param array $options |
||
| 40 | * @return null|ISchemaWrapper |
||
| 41 | */ |
||
| 42 | public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) |
||
| 43 | { |
||
| 44 | /** @var ISchemaWrapper $schema */ |
||
| 45 | $schema = $schemaClosure(); |
||
| 46 | |||
| 47 | if (!$schema->hasTable('analytics_panorama')) { |
||
| 48 | $table = $schema->createTable('analytics_panorama'); |
||
| 49 | $table->addColumn('id', 'integer', [ |
||
| 50 | 'autoincrement' => true, |
||
| 51 | 'notnull' => true, |
||
| 52 | ]); |
||
| 53 | $table->addColumn('user_id', 'string', [ |
||
| 54 | 'notnull' => true, |
||
| 55 | 'length' => 64, |
||
| 56 | ]); |
||
| 57 | $table->addColumn('name', 'string', [ |
||
| 58 | 'notnull' => true, |
||
| 59 | 'length' => 64, |
||
| 60 | ]); |
||
| 61 | $table->addColumn('type', 'integer', [ |
||
| 62 | 'notnull' => false, |
||
| 63 | ]); |
||
| 64 | $table->addColumn('parent', 'integer', [ |
||
| 65 | 'notnull' => false, |
||
| 66 | ]); |
||
| 67 | $table->addColumn('pages', 'text', [ |
||
| 68 | 'notnull' => false, |
||
| 69 | ]); |
||
| 70 | $table->setPrimaryKey(['id']); |
||
| 71 | $table->addIndex(['user_id'], 'analytics_panorama_user_id_idx'); |
||
| 72 | } |
||
| 73 | |||
| 74 | return $schema; |
||
| 75 | } |
||
| 76 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths