Code Duplication    Length = 36-46 lines in 3 locations

src/Migrations/Version20150312162849.php 1 location

@@ 13-48 (lines=36) @@
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
class Version20150312162849 extends AbstractMigration implements ContainerAwareInterface
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

src/Migrations/Version20150522164907.php 1 location

@@ 13-55 (lines=43) @@
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
class Version20150522164907 extends AbstractMigration implements ContainerAwareInterface
14
{
15
    /**
16
     * @var ContainerInterface
17
     */
18
    private $container;
19
20
    public function setContainer(ContainerInterface $container = null)
21
    {
22
        $this->container = $container;
23
    }
24
25
    /**
26
     * @param Schema $schema
27
     */
28
    public function up(Schema $schema)
29
    {
30
        $gatewaySchema = $this->getGatewaySchema();
31
32
        // this up() migration is auto-generated, please modify it to your needs
33
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
34
35
        $this->addSql(sprintf('CREATE UNIQUE INDEX unq_saml_entity_entity_id_type ON %s.saml_entity (entity_id, type)', $gatewaySchema));
36
    }
37
38
    /**
39
     * @param Schema $schema
40
     */
41
    public function down(Schema $schema)
42
    {
43
        $gatewaySchema = $this->getGatewaySchema();
44
45
        // this down() migration is auto-generated, please modify it to your needs
46
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
47
48
        $this->addSql(sprintf('DROP INDEX unq_saml_entity_entity_id_type ON %s.saml_entity', $gatewaySchema));
49
    }
50
51
    private function getGatewaySchema()
52
    {
53
        return $this->container->getParameter('database_gateway_name');
54
    }
55
}
56

src/Migrations/Version20150528154959.php 1 location

@@ 13-58 (lines=46) @@
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
class Version20150528154959 extends AbstractMigration implements ContainerAwareInterface
14
{
15
    /**
16
     * @var ContainerInterface
17
     */
18
    private $container;
19
20
    public function setContainer(ContainerInterface $container = null)
21
    {
22
        $this->container = $container;
23
    }
24
25
    /**
26
     * @param Schema $schema
27
     */
28
    public function up(Schema $schema)
29
    {
30
        // this up() migration is auto-generated, please modify it to your needs
31
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
32
33
        $gatewaySchema = $this->getGatewaySchema();
34
35
        $this->addSql(sprintf('ALTER TABLE %s.second_factor ADD display_locale VARCHAR(255) NOT NULL', $gatewaySchema));
36
    }
37
38
    /**
39
     * @param Schema $schema
40
     */
41
    public function down(Schema $schema)
42
    {
43
        // this down() migration is auto-generated, please modify it to your needs
44
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
45
46
        $gatewaySchema = $this->getGatewaySchema();
47
48
        $this->addSql(sprintf('ALTER TABLE %s.second_factor DROP display_locale', $gatewaySchema));
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    private function getGatewaySchema()
55
    {
56
        return $this->container->getParameter('database_gateway_name');
57
    }
58
}
59