Passed
Push — develop ( e1f02f...e3219b )
by Laurent
01:59
created

Version20210502131525::up()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 77
Code Lines 70

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 70
c 1
b 0
f 0
dl 0
loc 77
rs 8.6545
cc 1
nc 1
nop 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Core\Infrastructure\Doctrine\Migrations;
15
16
use Doctrine\DBAL\Schema\Schema;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Schema\Schema 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...
17
use Doctrine\Migrations\AbstractMigration;
0 ignored issues
show
Bug introduced by
The type Doctrine\Migrations\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...
18
19
/**
20
 * Auto-generated Migration: Please modify to your needs!
21
 */
22
final class Version20210502131525 extends AbstractMigration
23
{
24
    public function getDescription(): string
25
    {
26
        return 'Create the first throw of necessary tables.';
27
    }
28
29
    public function up(Schema $schema): void
30
    {
31
        // this up() migration is auto-generated, please modify it to your needs
32
        $this->addSql(
33
            'CREATE TABLE company (' .
34
            'uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ' .
35
            'company_name VARCHAR(255) NOT NULL, ' .
36
            'address VARCHAR(255) NOT NULL, ' .
37
            'zip_code VARCHAR(5) NOT NULL, ' .
38
            'town VARCHAR(255) NOT NULL, ' .
39
            'country VARCHAR(255) NOT NULL, ' .
40
            'phone VARCHAR(14) NOT NULL, ' .
41
            'facsimile VARCHAR(14) DEFAULT NULL, ' .
42
            'email VARCHAR(255) NOT NULL, ' .
43
            'contact_name VARCHAR(255) NOT NULL, ' .
44
            'cellphone VARCHAR(14) NOT NULL, ' .
45
            'slug VARCHAR(255) NOT NULL, ' .
46
            'UNIQUE INDEX UNIQ_4FBF094F1D4E64E8 (company_name), ' .
47
            'UNIQUE INDEX UNIQ_4FBF094F989D9B62 (slug), ' .
48
            'PRIMARY KEY(uuid)' .
49
            ') DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
50
        );
51
        $this->addSql(
52
            'CREATE TABLE settings (' .
53
            'uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ' .
54
            'locale VARCHAR(255) NOT NULL, ' .
55
            'currency VARCHAR(255) NOT NULL, ' .
56
            'PRIMARY KEY(uuid)' .
57
            ') DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
58
        );
59
        $this->addSql(
60
            'CREATE TABLE supplier (' .
61
            'uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ' .
62
            'family_log VARCHAR(255) NOT NULL, ' .
63
            'delay_delivery INT NOT NULL, ' .
64
            'order_days LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', ' .
65
            'active TINYINT(1) NOT NULL, ' .
66
            'company_name VARCHAR(255) NOT NULL, ' .
67
            'address VARCHAR(255) NOT NULL, ' .
68
            'zip_code VARCHAR(5) NOT NULL, ' .
69
            'town VARCHAR(255) NOT NULL, ' .
70
            'country VARCHAR(255) NOT NULL, ' .
71
            'phone VARCHAR(14) NOT NULL, ' .
72
            'facsimile VARCHAR(14) DEFAULT NULL, ' .
73
            'email VARCHAR(255) NOT NULL, ' .
74
            'contact_name VARCHAR(255) NOT NULL, ' .
75
            'cellphone VARCHAR(14) NOT NULL, s' .
76
            'lug VARCHAR(255) NOT NULL, ' .
77
            'UNIQUE INDEX UNIQ_9B2A6C7E1D4E64E8 (company_name), ' .
78
            'UNIQUE INDEX UNIQ_9B2A6C7E989D9B62 (slug), ' .
79
            'PRIMARY KEY(uuid)' .
80
            ') DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
81
        );
82
        $this->addSql(
83
            'CREATE TABLE user (' .
84
            'uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ' .
85
            'username VARCHAR(150) NOT NULL, ' .
86
            'email VARCHAR(255) NOT NULL, ' .
87
            'password VARCHAR(120) NOT NULL, ' .
88
            'roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', ' .
89
            'PRIMARY KEY(uuid)' .
90
            ') DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
91
        );
92
        $this->addSql(
93
            'CREATE TABLE messenger_messages (' .
94
            'id BIGINT AUTO_INCREMENT NOT NULL, ' .
95
            'body LONGTEXT NOT NULL, ' .
96
            'headers LONGTEXT NOT NULL, ' .
97
            'queue_name VARCHAR(190) NOT NULL, ' .
98
            'created_at DATETIME NOT NULL, ' .
99
            'available_at DATETIME NOT NULL, ' .
100
            'delivered_at DATETIME DEFAULT NULL, ' .
101
            'INDEX IDX_75EA56E0FB7336F0 (queue_name), ' .
102
            'INDEX IDX_75EA56E0E3BD61CE (available_at), ' .
103
            'INDEX IDX_75EA56E016BA31DB (delivered_at), ' .
104
            'PRIMARY KEY(id)' .
105
            ') DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
106
        );
107
    }
108
109
    public function down(Schema $schema): void
110
    {
111
        // this down() migration is auto-generated, please modify it to your needs
112
        $this->addSql('DROP TABLE company');
113
        $this->addSql('DROP TABLE settings');
114
        $this->addSql('DROP TABLE supplier');
115
        $this->addSql('DROP TABLE user');
116
        $this->addSql('DROP TABLE messenger_messages');
117
    }
118
}
119