CreateMigrationsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
1
<?php
2
3
namespace Yarak\Migrations;
4
5
use Phalcon\Db\Column;
6
use Phalcon\Db\Adapter\Pdo;
7
8
class CreateMigrationsTable implements Migration
9
{
10
    /**
11
     * Run the migration.
12
     *
13
     * @param Pdo $connection
14
     */
15
    public function up(Pdo $connection)
16
    {
17
        $connection->createTable(
18
            'migrations',
19
            null,
20
            [
21
                'columns' => [
22
                    new Column('migration', [
23
                        'type'    => Column::TYPE_VARCHAR,
24
                        'size'    => 250,
25
                        'notNull' => true,
26
                    ]),
27
                    new Column('batch', [
28
                        'type'    => Column::TYPE_INTEGER,
29
                        'size'    => 10,
30
                        'notNull' => true,
31
                    ]),
32
                ],
33
            ]
34
        );
35
    }
36
37
    /**
38
     * Reverse the migration.
39
     *
40
     * @param Pdo $connection
41
     */
42
    public function down(Pdo $connection)
43
    {
44
        $connection->dropTable('migrations');
45
    }
46
}
47