Version1::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace OpenTribes\Core\Migrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
use Doctrine\DBAL\Schema\Table;
8
use Doctrine\DBAL\Types\Type;
9
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
class Version1 extends AbstractMigration
14
{
15
16
    /**
17
     * @var Table
18
     */
19
    private $table;
20
21
    public function up(Schema $schema)
22
    {
23
24
25
        $this->table = $schema->createTable('users');
26
27
        $this->table->addColumn('userId', Type::INTEGER, array('length' => 11, 'autoincrement' => true));
28
        $this->table->addColumn('username', Type::STRING, array('length' => 254));
29
        $this->table->addColumn('password', Type::STRING, array('length' => 254));
30
        $this->table->addColumn('logins', Type::INTEGER, array('length' => 10, 'unsigned' => true, 'default' => 0));
31
        $this->table->addColumn('lastLogin', Type::DATETIME, array('notnull' => false));
32
        $this->table->addColumn('registered', Type::DATETIME, array('notnull' => false));
33
        $this->table->addColumn('lastAction', Type::DATETIME, array('notnull' => false));
34
        $this->table->addColumn('activationCode', Type::STRING, array('notnull' => false));
35
        $this->table->addColumn('email', Type::STRING);
36
        $this->table->setPrimaryKey(array("userId"));
37
38
39
    }
40
41
    public function down(Schema $schema)
42
    {
43
        $schema->dropTable('users');
44
    }
45
46
}
47