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

Version20230412051210   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 5 1
A getDescription() 0 3 1
A down() 0 3 1
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