Passed
Push — main ( ccc364...bce7d4 )
by Karl
06:19
created

Version20240608140840::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
c 1
b 1
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 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 Version20240608140840 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('CREATE TEMPORARY TABLE __temp__journal AS SELECT id, first_day, last_day, chart_of_account FROM journal');
24
        $this->addSql('DROP TABLE journal');
25
        $this->addSql('CREATE TABLE journal (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, organization_id INTEGER DEFAULT NULL, first_day DATE NOT NULL, last_day DATE NOT NULL, chart_of_account VARCHAR(255) DEFAULT NULL, CONSTRAINT FK_C1A7E74D32C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
26
        $this->addSql('INSERT INTO journal (id, first_day, last_day, chart_of_account) SELECT id, first_day, last_day, chart_of_account FROM __temp__journal');
27
        $this->addSql('DROP TABLE __temp__journal');
28
        $this->addSql('CREATE INDEX IDX_C1A7E74D32C8A3DE ON journal (organization_id)');
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('CREATE TEMPORARY TABLE __temp__journal AS SELECT id, first_day, last_day, chart_of_account FROM journal');
35
        $this->addSql('DROP TABLE journal');
36
        $this->addSql('CREATE TABLE journal (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, first_day DATE NOT NULL, last_day DATE NOT NULL, chart_of_account VARCHAR(255) DEFAULT NULL)');
37
        $this->addSql('INSERT INTO journal (id, first_day, last_day, chart_of_account) SELECT id, first_day, last_day, chart_of_account FROM __temp__journal');
38
        $this->addSql('DROP TABLE __temp__journal');
39
    }
40
}
41