Version20200620141949::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * Copyright (C) 2020  Jan Böhmer
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Affero General Public License as published
7
 * by the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Affero General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Affero General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
declare(strict_types=1);
20
21
namespace DoctrineMigrations;
22
23
use Doctrine\DBAL\Schema\Schema;
24
use Doctrine\Migrations\AbstractMigration;
25
26
/**
27
 * Auto-generated Migration: Please modify to your needs!
28
 */
29
final class Version20200620141949 extends AbstractMigration
30
{
31
    public function getDescription() : string
32
    {
33
        return '';
34
    }
35
36
    public function up(Schema $schema) : void
37
    {
38
        // this up() migration is auto-generated, please modify it to your needs
39
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
40
41
        $this->addSql('CREATE TABLE departments (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, blocked TINYINT(1) NOT NULL, comment LONGTEXT NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, creation_date DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
42
        $this->addSql('CREATE TABLE payment_orders (id INT AUTO_INCREMENT NOT NULL, department_id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, project_name VARCHAR(255) NOT NULL, amount INT NOT NULL, mathematically_correct TINYINT(1) NOT NULL, factually_correct TINYINT(1) NOT NULL, comment LONGTEXT NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, creation_date DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, bank_info_account_owner VARCHAR(255) NOT NULL, bank_info_street VARCHAR(255) NOT NULL, bank_info_zip_code VARCHAR(255) NOT NULL, bank_info_city VARCHAR(255) NOT NULL, bank_info_iban VARCHAR(255) NOT NULL, bank_info_bic VARCHAR(255) NOT NULL, bank_info_bank_name VARCHAR(255) NOT NULL, bank_info_reference VARCHAR(255) NOT NULL, INDEX IDX_C0176678AE80F5DF (department_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
43
        $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, role_description VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649F85E0677 (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
44
        $this->addSql('ALTER TABLE payment_orders ADD CONSTRAINT FK_C0176678AE80F5DF FOREIGN KEY (department_id) REFERENCES departments (id)');
45
    }
46
47
    public function down(Schema $schema) : void
48
    {
49
        // this down() migration is auto-generated, please modify it to your needs
50
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
51
52
        $this->addSql('ALTER TABLE payment_orders DROP FOREIGN KEY FK_C0176678AE80F5DF');
53
        $this->addSql('DROP TABLE departments');
54
        $this->addSql('DROP TABLE payment_orders');
55
        $this->addSql('DROP TABLE user');
56
    }
57
}
58