| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace AppBundle\Migration; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Doctrine\DBAL\Migrations\AbstractMigration; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Doctrine\DBAL\Schema\Schema; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * Auto-generated Migration: Please modify to your needs! | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | class Version20150813073404 extends AbstractMigration | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |      * @param Schema $schema | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 16 |  | View Code Duplication |     public function up(Schema $schema) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |         // this up() migration is auto-generated, please modify it to your needs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |         $this->addSql('CREATE TABLE audit_associations (id INT AUTO_INCREMENT NOT NULL, typ VARCHAR(128) NOT NULL, tbl VARCHAR(128) NOT NULL, `label` VARCHAR(255) DEFAULT NULL, fk VARCHAR(255) NOT NULL, class VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         $this->addSql('CREATE TABLE audit_logs (id INT AUTO_INCREMENT NOT NULL, source_id INT NOT NULL, target_id INT DEFAULT NULL, blame_id INT DEFAULT NULL, action VARCHAR(12) NOT NULL, tbl VARCHAR(128) NOT NULL, diff LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\', logged_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_D62F2858953C1C61 (source_id), UNIQUE INDEX UNIQ_D62F2858158E0B66 (target_id), UNIQUE INDEX UNIQ_D62F28588C082A2E (blame_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         $this->addSql('CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(255) NOT NULL, salt VARCHAR(48) NOT NULL, firstname VARCHAR(64) DEFAULT NULL, lastname VARCHAR(64) DEFAULT NULL, confirmation_token VARCHAR(48) DEFAULT NULL, roles INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, password VARCHAR(64) DEFAULT NULL, UNIQUE INDEX UNIQ_1483A5E9E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         $this->addSql('CREATE TABLE app_fixtures (name VARCHAR(255) NOT NULL, PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         $this->addSql('CREATE TABLE cms_block (id INT AUTO_INCREMENT NOT NULL, alias VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $this->addSql('CREATE TABLE mail_templates (id INT AUTO_INCREMENT NOT NULL, alias VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_17F263EDE16C6B94 (alias), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $this->addSql('ALTER TABLE audit_logs ADD CONSTRAINT FK_D62F2858953C1C61 FOREIGN KEY (source_id) REFERENCES audit_associations (id)'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $this->addSql('ALTER TABLE audit_logs ADD CONSTRAINT FK_D62F2858158E0B66 FOREIGN KEY (target_id) REFERENCES audit_associations (id)'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         $this->addSql('ALTER TABLE audit_logs ADD CONSTRAINT FK_D62F28588C082A2E FOREIGN KEY (blame_id) REFERENCES audit_associations (id)'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 30 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |      * @param Schema $schema | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 35 |  | View Code Duplication |     public function down(Schema $schema) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         // this down() migration is auto-generated, please modify it to your needs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $this->addSql('ALTER TABLE audit_logs DROP FOREIGN KEY FK_D62F2858953C1C61'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $this->addSql('ALTER TABLE audit_logs DROP FOREIGN KEY FK_D62F2858158E0B66'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $this->addSql('ALTER TABLE audit_logs DROP FOREIGN KEY FK_D62F28588C082A2E'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $this->addSql('DROP TABLE audit_associations'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         $this->addSql('DROP TABLE audit_logs'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $this->addSql('DROP TABLE users'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $this->addSql('DROP TABLE app_fixtures'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         $this->addSql('DROP TABLE cms_block'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         $this->addSql('DROP TABLE mail_templates'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 49 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 50 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |  | 
            
                        
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.