Passed
Push — develop ( 6aee1f...eb8792 )
by Laurent
01:33
created

GlsrDefinition   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 59
c 1
b 0
f 0
dl 0
loc 71
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B define() 0 69 1
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 Administration\Infrastructure\Resources\doctrine;
15
16
use DbalSchema\SchemaDefinition;
0 ignored issues
show
Bug introduced by
The type DbalSchema\SchemaDefinition 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\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...
18
19
class GlsrDefinition implements SchemaDefinition
20
{
21
    public function define(Schema $schema): void
22
    {
23
        // Messenger definition
24
        $messengerTable = $schema->createTable('messenger_messages');
25
        $messengerTable->addColumn('id', 'bigint', ['autoincrement' => true]);
26
        $messengerTable->addColumn('body', 'text');
27
        $messengerTable->addColumn('headers', 'text');
28
        $messengerTable->addColumn('queue_name', 'string', ['length' => 190]);
29
        $messengerTable->addColumn('created_at', 'datetime');
30
        $messengerTable->addColumn('available_at', 'datetime');
31
        $messengerTable->addColumn('delivered_at', 'datetime', ['notnull' => false]);
32
        $messengerTable->addIndex(['queue_name']);
33
        $messengerTable->addIndex(['available_at']);
34
        $messengerTable->addIndex(['delivered_at']);
35
        $messengerTable->setPrimaryKey(['id']);
36
37
        // Company definition
38
        $companyTable = $schema->createTable('company');
39
        $companyTable->addColumn('uuid', 'string', ['length' => 36]);
40
        $companyTable->addColumn('name', 'string', ['length' => 150]);
41
        $companyTable->addColumn('address', 'string');
42
        $companyTable->addColumn('zip_code', 'string', ['length' => 5]);
43
        $companyTable->addColumn('town', 'string');
44
        $companyTable->addColumn('country', 'string');
45
        $companyTable->addColumn('phone', 'string', ['length' => 12]);
46
        $companyTable->addColumn('facsimile', 'string', ['notnull' => false, 'length' => 12]);
47
        $companyTable->addColumn('email', 'string');
48
        $companyTable->addColumn('contact_name', 'string');
49
        $companyTable->addColumn('cellphone', 'string', ['length' => 12]);
50
        $companyTable->addColumn('slug', 'string');
51
        $companyTable->setPrimaryKey(['uuid']);
52
53
        // Settings definition
54
        $settingsTable = $schema->createTable('settings');
55
        $settingsTable->addColumn('uuid', 'string', ['length' => 36]);
56
        $settingsTable->addColumn('currency', 'string', ['length' => 20]);
57
        $settingsTable->addColumn('locale', 'string', ['length' => 10]);
58
        $settingsTable->setPrimaryKey(['uuid']);
59
60
        // User definition
61
        $userTable = $schema->createTable('user');
62
        $userTable->addColumn('uuid', 'string', ['length' => 36]);
63
        $userTable->addColumn('username', 'string', ['length' => 150]);
64
        $userTable->addColumn('email', 'string');
65
        $userTable->addColumn('password', 'string', ['length' => 120]);
66
        $userTable->addColumn('roles', 'simple_array');
67
        $userTable->setPrimaryKey(['uuid']);
68
69
        // Supplier definition
70
        $supplierTable = $schema->createTable('supplier');
71
        $supplierTable->addColumn('uuid', 'string', ['length' => 36]);
72
        $supplierTable->addColumn('name', 'string', ['length' => 150]);
73
        $supplierTable->addColumn('address', 'string');
74
        $supplierTable->addColumn('zip_code', 'string', ['length' => 5]);
75
        $supplierTable->addColumn('town', 'string');
76
        $supplierTable->addColumn('country', 'string');
77
        $supplierTable->addColumn('phone', 'string', ['length' => 12]);
78
        $supplierTable->addColumn('facsimile', 'string', ['notnull' => false, 'length' => 12]);
79
        $supplierTable->addColumn('email', 'string');
80
        $supplierTable->addColumn('contact_name', 'string');
81
        $supplierTable->addColumn('cellphone', 'string', ['length' => 12]);
82
        $supplierTable->addColumn('family_log', 'string');
83
        $supplierTable->addColumn('delay_delivery', 'integer');
84
        $supplierTable->addColumn('order_days', 'simple_array');
85
        $supplierTable->addColumn('slug', 'string');
86
        $supplierTable->addColumn('active', 'smallint', ['length' => 1]);
87
        $supplierTable->setPrimaryKey(['uuid']);
88
        $supplierTable->addUniqueIndex(['name']);
89
        $supplierTable->addUniqueIndex(['slug']);
90
    }
91
}
92