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

AddOauth2AccessTokensTable20230802151233::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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 AddOauth2AccessTokensTable20230802151233 extends AbstractMigration
11
{
12
    public function up(): void
13
    {
14
      //Action when migrate up
15
        $this->create('oauth_access_tokens', function (CreateTable $table) {
16
            $table->string('access_token', 100)
17
                  ->notNull()
18
                  ->description('The access token')
19
                 ->primary();
20
21
            $table->string('scope', 2000)
22
                   ->description('The access token scopes separated with space if many');
23
24
            $table->datetime('expires')
25
                   ->notNull()
26
                   ->description('The access token expire time');
27
28
            $table->integer('user_id')
29
                ->description('The owner of access token');
30
31
            $table->string('client_id')
32
                ->description('The access token client')
33
                ->notNull();
34
35
            $table->timestamps();
36
37
            $table->foreign('client_id')
38
                ->references('oauth_clients', 'id')
39
                ->onDelete('NO ACTION');
40
41
            $table->engine('INNODB');
42
        });
43
    }
44
45
    public function down(): void
46
    {
47
      //Action when migrate down
48
        $this->drop('oauth_access_tokens');
49
    }
50
}
51