| Conditions | 1 |
| Paths | 1 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 10 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 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 image (id CHAR(36) NOT NULL COMMENT \'(DC2Type:file_id)\', created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, name VARCHAR(150) NOT NULL, extension VARCHAR(10) NOT NULL, mime_type VARCHAR(100) NOT NULL, UNIQUE INDEX search_idx (name, extension), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); |
||
| 22 | $this->addSql('ALTER TABLE user ADD image_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:file_id)\''); |
||
| 23 | $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6493DA5256D FOREIGN KEY (image_id) REFERENCES image (id)'); |
||
| 24 | $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D6493DA5256D ON user (image_id)'); |
||
| 25 | } |
||
| 26 | |||
| 41 |
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.