Version20160214204059::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace T3Botmigrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
use Doctrine\DBAL\Types\Type;
8
9
/**
10
 * Auto-generated Migration: Please modify to your needs!
11
 */
12
class Version20160214204059 extends AbstractMigration
13
{
14
    /**
15
     * @param Schema $schema
16
     */
17
    public function up(Schema $schema)
18
    {
19
        // create beer table
20
        $beerTable = $schema->createTable('beers');
21
        $beerTable->addColumn('id', Type::INTEGER, ['unsigned' => true])->setAutoincrement(true);
22
        $beerTable->addColumn('from_user', Type::STRING, ['length' => 32]);
23
        $beerTable->addColumn('to_user', Type::STRING, ['length' => 32]);
24
        $beerTable->addColumn('tstamp', Type::INTEGER, ['unsigned' => true]);
25
        $beerTable->setPrimaryKey(['id']);
26
27
        // create messages table
28
        $messagesTable = $schema->createTable('messages');
29
        $messagesTable->addColumn('id', Type::INTEGER, ['unsigned' => true])->setAutoincrement(true);
30
        $messagesTable->addColumn('message', Type::TEXT);
31
        $messagesTable->setPrimaryKey(['id']);
32
    }
33
34
    /**
35
     * @param Schema $schema
36
     */
37
    public function down(Schema $schema)
38
    {
39
        // Drop beer table
40
        $schema->dropTable('beers');
41
42
        // Drop messages table
43
        $schema->dropTable('messages');
44
    }
45
}
46