Passed
Push — main ( f77605...60524e )
by MusikAnimal
04:12
created

Version20230412051210::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineMigrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
final class Version20230412051210 extends AbstractMigration
14
{
15
    public function getDescription() : string
16
    {
17
        return 'Creates the table that stores user sessions.';
18
    }
19
20
    public function up(Schema $schema) : void
21
    {
22
        // From https://symfony.com/doc/5.4/session.html#mariadb-mysql
23
        $this->addSql(
24
            "CREATE TABLE `sessions` (
25
                `sess_id` VARBINARY(128) NOT NULL PRIMARY KEY,
26
                `sess_data` BLOB NOT NULL,
27
                `sess_lifetime` INTEGER UNSIGNED NOT NULL,
28
                `sess_time` INTEGER UNSIGNED NOT NULL,
29
                INDEX `sessions_sess_lifetime_idx` (`sess_lifetime`)
30
            ) COLLATE utf8mb4_bin, ENGINE = InnoDB;"
31
        );
32
    }
33
34
    public function down(Schema $schema) : void
35
    {
36
        $schema->dropTable('sessions');
37
    }
38
}
39