Completed
Push — Recipes ( c0466a...7632b6 )
by Laurent
04:22
created

Version20190316142735   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 10 1
A down() 0 10 1
A getDescription() 0 3 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 Version20190316142735 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
24
25
        $this->addSql('CREATE TABLE app_tva (id INT AUTO_INCREMENT NOT NULL, rate NUMERIC(4, 3) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
26
        $this->addSql('CREATE TABLE app_zonestorage (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_CBBFF279989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
27
        $this->addSql('CREATE TABLE app_unit (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, abbr VARCHAR(50) NOT NULL, slug VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_D99529F3989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
28
        $this->addSql('CREATE TABLE app_familylog (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, path VARCHAR(3000) DEFAULT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(128) NOT NULL, level INT DEFAULT NULL, UNIQUE INDEX UNIQ_824FA4AA989D9B62 (slug), INDEX IDX_824FA4AA727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
29
        $this->addSql('ALTER TABLE app_familylog ADD CONSTRAINT FK_824FA4AA727ACA70 FOREIGN KEY (parent_id) REFERENCES app_familylog (id) ON DELETE CASCADE');
30
    }
31
32
    public function down(Schema $schema) : void
33
    {
34
        // this down() migration is auto-generated, please modify it to your needs
35
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
36
37
        $this->addSql('ALTER TABLE app_familylog DROP FOREIGN KEY FK_824FA4AA727ACA70');
38
        $this->addSql('DROP TABLE app_tva');
39
        $this->addSql('DROP TABLE app_zonestorage');
40
        $this->addSql('DROP TABLE app_unit');
41
        $this->addSql('DROP TABLE app_familylog');
42
    }
43
}
44