Passed
Push — master ( 809fdb...121155 )
by Florian
03:59
created

Version20180919170715::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the feedback project.
7
 *
8
 * (c) Florian Moser <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace DoctrineMigrations;
15
16
use Doctrine\DBAL\Schema\Schema;
17
use Doctrine\Migrations\AbstractMigration;
18
19
/**
20
 * Auto-generated Migration: Please modify to your needs!
21
 */
22
final class Version20180919170715 extends AbstractMigration
23
{
24
    public function up(Schema $schema): void
25
    {
26
        // this up() migration is auto-generated, please modify it to your needs
27
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');
28
29
        $this->addSql('CREATE TABLE semester (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name CLOB NOT NULL, creation_date DATETIME NOT NULL)');
30
        $this->addSql('CREATE TABLE event (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, semester_id INTEGER DEFAULT NULL, name CLOB NOT NULL, date CLOB NOT NULL, feedback_start_time CLOB NOT NULL, feedback_end_time CLOB NOT NULL, template CLOB NOT NULL, template_name CLOB NOT NULL, has_lecture BOOLEAN NOT NULL, has_exercise BOOLEAN NOT NULL, final_template_version_loaded BOOLEAN NOT NULL)');
31
        $this->addSql('CREATE INDEX IDX_3BAE0AA74A798B6F ON event (semester_id)');
32
        $this->addSql('CREATE TABLE participant (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, event_id INTEGER DEFAULT NULL)');
33
        $this->addSql('CREATE INDEX IDX_D79F6B1171F7E88B ON participant (event_id)');
34
        $this->addSql('CREATE TABLE answer (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, participant_id INTEGER DEFAULT NULL, question_number INTEGER NOT NULL, value CLOB NOT NULL)');
35
        $this->addSql('CREATE INDEX IDX_DADD4A259D1C3019 ON answer (participant_id)');
36
    }
37
38
    public function down(Schema $schema): void
39
    {
40
        // this down() migration is auto-generated, please modify it to your needs
41
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');
42
43
        $this->addSql('DROP TABLE semester');
44
        $this->addSql('DROP TABLE event');
45
        $this->addSql('DROP TABLE participant');
46
        $this->addSql('DROP TABLE answer');
47
    }
48
}
49