Completed
Push — master ( 9b5005...0cce4e )
by Loïc
14s queued 12s
created

Version20191231140333::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Migrations;
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 Version20191231140333 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_admin_avatar (id INT AUTO_INCREMENT NOT NULL, path VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
26
        $this->addSql('ALTER TABLE sylius_admin_user ADD avatar_id INT DEFAULT NULL');
27
        $this->addSql('ALTER TABLE sylius_admin_user ADD CONSTRAINT FK_88D5CC4D86383B10 FOREIGN KEY (avatar_id) REFERENCES app_admin_avatar (id)');
28
        $this->addSql('CREATE UNIQUE INDEX UNIQ_88D5CC4D86383B10 ON sylius_admin_user (avatar_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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
35
36
        $this->addSql('ALTER TABLE sylius_admin_user DROP FOREIGN KEY FK_88D5CC4D86383B10');
37
        $this->addSql('DROP TABLE app_admin_avatar');
38
        $this->addSql('DROP INDEX UNIQ_88D5CC4D86383B10 ON sylius_admin_user');
39
        $this->addSql('ALTER TABLE sylius_admin_user DROP avatar_id');
40
    }
41
}
42