Failed Conditions
Pull Request — master (#155)
by Adrien
15:34
created

Version20250423020434   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 28
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 18
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 27 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
class Version20250423020434 extends AbstractMigration
11
{
12
    public function up(Schema $schema): void
13
    {
14
        $this->addSql(<<<'SQL'
15
                ALTER TABLE account CHANGE balance balance INT DEFAULT 0 NOT NULL, CHANGE type type ENUM('asset', 'liability', 'revenue', 'expense', 'equity', 'group') NOT NULL, CHANGE total_balance total_balance INT DEFAULT 0 NOT NULL, CHANGE budget_allowed budget_allowed INT DEFAULT NULL, CHANGE budget_balance budget_balance INT AS (IF(type = 'asset', budget_allowed - (total_balance - total_balance_former), budget_allowed - total_balance)) PERSISTENT, CHANGE total_balance_former total_balance_former INT DEFAULT 0 NOT NULL
16
            SQL);
17
        $this->addSql(<<<'SQL'
18
                ALTER TABLE bookable CHANGE initial_price initial_price INT DEFAULT 0 NOT NULL, CHANGE periodic_price periodic_price INT DEFAULT 0 NOT NULL, CHANGE purchase_price purchase_price INT UNSIGNED DEFAULT NULL, CHANGE booking_type booking_type ENUM('self_approved', 'application', 'admin_assigned', 'admin_approved', 'mandatory') DEFAULT 'admin_approved' NOT NULL, CHANGE state state ENUM('good', 'used', 'degraded') DEFAULT 'good' NOT NULL
19
            SQL);
20
        $this->addSql(<<<'SQL'
21
                ALTER TABLE booking CHANGE status status ENUM('application', 'booked', 'processed') DEFAULT 'application' NOT NULL
22
            SQL);
23
        $this->addSql(<<<'SQL'
24
                ALTER TABLE expense_claim CHANGE amount amount INT UNSIGNED NOT NULL, CHANGE status status ENUM('new', 'processing', 'processed', 'rejected') DEFAULT 'new' NOT NULL, CHANGE type type ENUM('expenseClaim', 'refund', 'invoice') DEFAULT 'expenseClaim' NOT NULL
25
            SQL);
26
        $this->addSql(<<<'SQL'
27
                ALTER TABLE log CHANGE extra extra JSON DEFAULT '{}' NOT NULL
28
            SQL);
29
        $this->addSql(<<<'SQL'
30
                ALTER TABLE message CHANGE type type ENUM('register', 'unregister', 'reset_password', 'balance', 'leave_family', 'admin_leave_family') NOT NULL
31
            SQL);
32
        $this->addSql(<<<'SQL'
33
                ALTER TABLE transaction CHANGE balance balance INT UNSIGNED DEFAULT 0 NOT NULL
34
            SQL);
35
        $this->addSql(<<<'SQL'
36
                ALTER TABLE transaction_line CHANGE balance balance INT UNSIGNED NOT NULL
37
            SQL);
38
        $this->addSql(<<<'SQL'
39
                ALTER TABLE user CHANGE role role ENUM('booking_only', 'individual', 'accounting_verificator', 'member', 'trainer', 'formation_responsible', 'responsible', 'administrator') DEFAULT 'individual' NOT NULL, CHANGE status status ENUM('inactive', 'new', 'active', 'archived') DEFAULT 'new' NOT NULL, CHANGE swiss_sailing_type swiss_sailing_type ENUM('active', 'passive', 'junior') DEFAULT NULL, CHANGE swiss_windsurf_type swiss_windsurf_type ENUM('active', 'passive') DEFAULT NULL, CHANGE family_relationship family_relationship ENUM('householder', 'partner', 'child', 'parent', 'sister', 'brother') DEFAULT 'householder' NOT NULL, CHANGE billing_type billing_type ENUM('electronic', 'paper') DEFAULT 'electronic' NOT NULL
40
            SQL);
41
    }
42
}
43