CreateMigrationTableMigration::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
cc 1
eloc 14
nc 1
nop 2
1
<?php
2
3
namespace RDV\Bundle\MigrationBundle\Migration;
4
5
use Doctrine\DBAL\Schema\Schema;
6
7
class CreateMigrationTableMigration implements Migration
8
{
9
    /**
10
     * @inheritdoc
11
     */
12
    public function up(Schema $schema, QueryBag $queries)
13
    {
14
        $table = $schema->createTable(Tables::MIGRATION_TABLE);
15
        $table->addColumn('id', 'integer', ['notnull' => true, 'autoincrement' => true]);
16
        $table->addColumn('bundle', 'string', ['notnull' => true, 'length' => 250]);
17
        $table->addColumn('version', 'string', ['notnull' => true, 'length' => 250]);
18
        $table->addColumn('loaded_at', 'datetime', ['notnull' => true]);
19
        $table->setPrimaryKey(['id']);
20
        $table->addIndex(['bundle'], 'idx_rdv_migrations', []);
21
22
        $table = $schema->createTable(Tables::MIGRATION_DATA_TABLE);
23
        $table->addColumn('id', 'integer', ['notnull' => true, 'autoincrement' => true]);
24
        $table->addColumn('class_name', 'string', ['default' => null, 'notnull' => true, 'length' => 255]);
25
        $table->addColumn('loaded_at', 'datetime', ['notnull' => true]);
26
        $table->addColumn('version', 'string', ['notnull' => false, 'length' => 255]);
27
        $table->setPrimaryKey(['id']);
28
    }
29
}
30