Completed
Push — feature/test-php-7-2-in-travis ( a56bae...2774bc )
by
unknown
02:41
created

Version20150312162849::setContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Surfnet\Migrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13 View Code Duplication
class Version20150312162849 extends AbstractMigration implements ContainerAwareInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * @var \Symfony\Component\DependencyInjection\ContainerInterface
17
     */
18
    private $container;
19
20
    public function up(Schema $schema)
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
        $gatewaySchema = $this->container->getParameter('database_gateway_name');
26
        $this->addSql(sprintf(
27
            'ALTER TABLE %s.second_factor CHANGE second_factor_identifier second_factor_identifier VARCHAR(255) NOT NULL',
28
            $gatewaySchema
29
        ));
30
    }
31
32
    public function down(Schema $schema)
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
        $gatewaySchema = $this->container->getParameter('database_gateway_name');
38
        $this->addSql(sprintf(
39
            'ALTER TABLE %s.second_factor CHANGE second_factor_identifier second_factor_identifier VARCHAR(36) NOT NULL COLLATE utf8_unicode_ci',
40
            $gatewaySchema
41
        ));
42
    }
43
44
    public function setContainer(ContainerInterface $container = null)
45
    {
46
        $this->container = $container;
47
    }
48
}
49