Passed
Push — develop ( f56b47...da1be7 )
by nguereza
02:00
created

AddOauth2ClientsTable20230802150106::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 21
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 32
rs 9.584
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Platine\Framework\Migration;
6
7
use Platine\Database\Schema\CreateTable;
0 ignored issues
show
Bug introduced by
The type Platine\Database\Schema\CreateTable 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Platine\Framework\Migration\AbstractMigration;
0 ignored issues
show
Bug introduced by
The type Platine\Framework\Migration\AbstractMigration 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class AddOauth2ClientsTable20230802150106 extends AbstractMigration
11
{
12
    public function up(): void
13
    {
14
      //Action when migrate up
15
        $this->create('oauth_clients', function (CreateTable $table) {
16
            $table->string('id', 100)
17
                  ->notNull()
18
                  ->description('The client id')
19
                 ->primary();
20
21
            $table->string('name', 80)
22
                  ->description('The client or app name')
23
                 ->notNull();
24
25
            $table->string('secret', 80)
26
                   ->description('The client secret must be null for public client');
27
28
            $table->string('redirect_uri', 2000)
29
                   ->notNull()
30
                   ->description('The client redirect uri separated with space if many');
31
32
            $table->string('scope', 2000)
33
                   ->description('The client scopes separated with space if many');
34
35
            $table->string('grant_types', 100)
36
                   ->description('The client supported grant types separated with space if many');
37
38
            $table->integer('user_id')
39
                ->description('The owner or client developer');
40
41
            $table->timestamps();
42
43
            $table->engine('INNODB');
44
        });
45
    }
46
47
    public function down(): void
48
    {
49
      //Action when migrate down
50
        $this->drop('oauth_clients');
51
    }
52
}
53