Completed
Push — master ( 19732d...076741 )
by Paweł
11:47
created

Version20180905135049::setContainer()   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 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SWP\Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
10
use Symfony\Component\DependencyInjection\ContainerInterface;
11
12
/**
13
 * Auto-generated Migration: Please modify to your needs!
14
 */
15
final class Version20180905135049 extends AbstractMigration implements ContainerAwareInterface
16
{
17
    /**
18
     * @var ContainerInterface
19
     */
20
    private $container;
21
22
    /**
23
     * @param ContainerInterface|null $container
24
     */
25
    public function setContainer(ContainerInterface $container = null)
26
    {
27
        $this->container = $container;
28
    }
29
30
    public function up(Schema $schema): void
31
    {
32
        // this up() migration is auto-generated, please modify it to your needs
33
        $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');
34
35
        $this->addSql('ALTER TABLE swp_article_statistics ALTER internal_click_rate TYPE DOUBLE PRECISION');
36
        $this->addSql('ALTER TABLE swp_article_statistics ALTER internal_click_rate DROP DEFAULT');
37
    }
38
39
    public function down(Schema $schema): void
40
    {
41
        // this down() migration is auto-generated, please modify it to your needs
42
        $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');
43
44
        $this->addSql('ALTER TABLE swp_article_statistics ALTER internal_click_rate TYPE INT');
45
        $this->addSql('ALTER TABLE swp_article_statistics ALTER internal_click_rate DROP DEFAULT');
46
    }
47
}
48