Passed
Pull Request — master (#26)
by Paweł
04:18
created

Version20190708085508::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 6
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
final class Version20190708085508 extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return 'add settings bundle tables';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');
20
21
        $this->addSql('CREATE SEQUENCE npd_settings_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
22
        $this->addSql('CREATE TABLE npd_settings (
23
          id INT NOT NULL, 
24
          created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, 
25
          updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, 
26
          scope VARCHAR(255) NOT NULL, 
27
          value TEXT NOT NULL, 
28
          name VARCHAR(255) NOT NULL, 
29
          owner INT DEFAULT NULL, 
30
          PRIMARY KEY(id)
31
        )');
32
    }
33
34
    public function down(Schema $schema): void
35
    {
36
        // this down() migration is auto-generated, please modify it to your needs
37
        $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');
38
39
        $this->addSql('DROP SEQUENCE npd_settings_id_seq CASCADE');
40
        $this->addSql('DROP TABLE npd_settings');
41
    }
42
}
43