Completed
Push — master ( 71eba9...1e1a94 )
by Valentyn
04:31
created

Version20190824145325   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 9 1
A down() 0 6 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
final class Version20190824145325 extends AbstractMigration
11
{
12
    public function up(Schema $schema): void
13
    {
14
        $this->addSql('CREATE SEQUENCE movie_card_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
15
        $this->addSql('CREATE TABLE movie_card (id INT NOT NULL, movie_id INT NOT NULL, user_id INT NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, locale VARCHAR(2) NOT NULL, PRIMARY KEY(id))');
16
        $this->addSql('CREATE INDEX IDX_E572B9DE8F93B6FC ON movie_card (movie_id)');
17
        $this->addSql('CREATE INDEX IDX_E572B9DEA76ED395 ON movie_card (user_id)');
18
        $this->addSql('ALTER TABLE movie_card ADD CONSTRAINT FK_E572B9DE8F93B6FC FOREIGN KEY (movie_id) REFERENCES movies (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
19
        $this->addSql('ALTER TABLE movie_card ADD CONSTRAINT FK_E572B9DEA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
20
    }
21
22
    public function down(Schema $schema): void
23
    {
24
        $this->addSql('CREATE SCHEMA public');
25
        $this->addSql('DROP SEQUENCE movie_card_id_seq CASCADE');
26
        $this->addSql('DROP TABLE movie_card');
27
    }
28
}
29