Failed Conditions
Pull Request — develop (#3581)
by Jonathan
12:44
created

TableGeneratorSchemaVisitor::acceptSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0046

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1.0046
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Id;
6
7
use Doctrine\DBAL\Schema\Column;
8
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
9
use Doctrine\DBAL\Schema\Index;
10
use Doctrine\DBAL\Schema\Schema;
11
use Doctrine\DBAL\Schema\Sequence;
12
use Doctrine\DBAL\Schema\Table;
13
use Doctrine\DBAL\Schema\Visitor\Visitor;
14
15
class TableGeneratorSchemaVisitor implements Visitor
16
{
17
    /** @var string */
18
    private $generatorTableName;
19
20 48
    public function __construct(string $generatorTableName = 'sequences')
21
    {
22 48
        $this->generatorTableName = $generatorTableName;
23 48
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 48
    public function acceptSchema(Schema $schema) : void
29
    {
30 48
        $table = $schema->createTable($this->generatorTableName);
31 48
        $table->addColumn('sequence_name', 'string');
32 48
        $table->addColumn('sequence_value', 'integer', ['default' => 1]);
33 48
        $table->addColumn('sequence_increment_by', 'integer', ['default' => 1]);
34 48
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 48
    public function acceptTable(Table $table) : void
40
    {
41 48
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 48
    public function acceptColumn(Table $table, Column $column) : void
47
    {
48 48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
54
    {
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function acceptIndex(Table $table, Index $index) : void
61
    {
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function acceptSequence(Sequence $sequence) : void
68
    {
69
    }
70
}
71