Version20210109200610::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 9
rs 10
c 1
b 0
f 0
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 Version20210109200610 extends AbstractMigration
14
{
15
    public function getDescription() : string
16
    {
17
        return '';
18
    }
19
20
    public function up(Schema $schema) : void
21
    {
22
        // this up() migration is auto-generated, please modify it to your needs
23
        $this->addSql('ALTER TABLE departments ADD references_export_prefix VARCHAR(255) DEFAULT NULL, ADD skip_blocked_validation_tokens LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
24
        $this->addSql('ALTER TABLE payment_orders ADD booking_date DATETIME DEFAULT NULL, ADD references_exported TINYINT(1) NOT NULL');
25
26
        //Normally setting the factually correct field to 1 should be the last action done to a payment order
27
        //This way we can determine a booking date for old payment orders.
28
        $this->addSql('UPDATE payment_orders SET booking_date = last_modified WHERE factually_correct = 1 AND exported = 1;');
29
    }
30
31
    public function down(Schema $schema) : void
32
    {
33
        // this down() migration is auto-generated, please modify it to your needs
34
        $this->addSql('ALTER TABLE departments DROP references_export_prefix, DROP skip_blocked_validation_tokens');
35
        $this->addSql('ALTER TABLE payment_orders DROP booking_date, DROP references_exported');
36
    }
37
}
38