Completed
Push — master ( 229d8c...e7f8de )
by Dmitry
02:48
created

Tracker::migrate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.864

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
ccs 4
cts 10
cp 0.4
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
crap 2.864
1
<?php
2
3
namespace Tarantool\Mapper\Migrations;
4
5
use Tarantool\Mapper\Contracts;
6
7
class Tracker implements Contracts\Migration
8
{
9 64
    public function migrate(Contracts\Manager $manager)
10
    {
11 64
        if (!$manager->getSchema()->hasSpace('meta')) {
12 64
            $migration = new Bootstrap();
13 64
            $migration->migrate($manager);
14
        }
15
16
        $migration = $manager->getMeta()->create('migrations', ['name']);
17
        $migration->addIndex('name');
18
19
        $manager->create('migrations', Bootstrap::class);
20
        $manager->create('migrations', self::class);
21
    }
22
}
23