Code Duplication    Length = 25-26 lines in 2 locations

htdocs/app/Migrations/Version20160607213541.php 1 location

@@ 11-36 (lines=26) @@
8
/**
9
 * Migration to create field_note table and add foreign keys.
10
 */
11
class Version20160607213541 extends AbstractMigration
12
{
13
    /**
14
     * @param Schema $schema
15
     */
16
    public function up(Schema $schema)
17
    {
18
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
19
20
        $this->addSql('CREATE TABLE field_note (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, geocache_id INT DEFAULT NULL, type SMALLINT NOT NULL, date DATETIME NOT NULL, text VARCHAR(255) DEFAULT NULL, INDEX IDX_DC7193AEA76ED395 (user_id), INDEX IDX_DC7193AE67030974 (geocache_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ENGINE = MyISAM');
21
        $this->addSql('ALTER TABLE field_note ADD CONSTRAINT FK_DC7193AEA76ED395 FOREIGN KEY (user_id) REFERENCES user (user_id) ON DELETE CASCADE');
22
        $this->addSql('ALTER TABLE field_note ADD CONSTRAINT FK_DC7193AE67030974 FOREIGN KEY (geocache_id) REFERENCES caches (cache_id) ON DELETE CASCADE');
23
    }
24
25
    /**
26
     * @param Schema $schema
27
     */
28
    public function down(Schema $schema)
29
    {
30
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
31
32
        $this->addSql('DROP TABLE field_note');
33
    }
34
}
35

htdocs/app/Migrations/Version20170221215409.php 1 location

@@ 11-35 (lines=25) @@
8
/**
9
 * Migration to add column admin_password and roles to user table.
10
 */
11
class Version20170221215409 extends AbstractMigration
12
{
13
    /**
14
     * @param Schema $schema
15
     */
16
    public function up(Schema $schema)
17
    {
18
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
19
20
        $this->addSql('ALTER TABLE `user` ADD `admin_password` BINARY(60)  NULL  DEFAULT NULL  AFTER `password`');
21
        $this->addSql('ALTER TABLE `user` ADD `roles` TEXT  NULL  AFTER `admin_password`;');
22
    }
23
24
    /**
25
     * @param Schema $schema
26
     */
27
    public function down(Schema $schema)
28
    {
29
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
30
31
        $this->addSql('ALTER TABLE `user` DROP `admin_password`');
32
        $this->addSql('ALTER TABLE `user` DROP `roles`');
33
    }
34
}
35