Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. <?php declare(strict_types = 1);
  2.  
  3. namespace DoctrineMigrations;
  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 Version20180409165522 extends AbstractMigration
  12. {
  13. public function up(Schema $schema)
  14. {
  15. // this up() migration is auto-generated, please modify it to your needs
  16. $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
  17.  
  18. $this->addSql('ALTER TABLE TyreData CHANGE id id INT AUTO_INCREMENT NOT NULL');
  19. $this->addSql('ALTER TABLE TyreData ADD CONSTRAINT FK_F603601B44F5D008 FOREIGN KEY (brand_id) REFERENCES tyre_mark (id)');
  20. $this->addSql('ALTER TABLE TyreData ADD CONSTRAINT FK_F603601B498DA827 FOREIGN KEY (size_id) REFERENCES tyre_size (id)');
  21. $this->addSql('ALTER TABLE TyreData ADD CONSTRAINT FK_F603601B84337261 FOREIGN KEY (index_id) REFERENCES tyre_index (id)');
  22. $this->addSql('ALTER TABLE TyreData ADD CONSTRAINT FK_F603601B7975B7E7 FOREIGN KEY (model_id) REFERENCES tail_model (id)');
  23. $this->addSql('ALTER TABLE TyreData ADD CONSTRAINT FK_F603601B44DE2601 FOREIGN KEY (cai_id) REFERENCES tyre_cai (id)');
  24. $this->addSql('CREATE INDEX IDX_F603601B44F5D008 ON TyreData (brand_id)');
  25. $this->addSql('CREATE INDEX IDX_F603601B498DA827 ON TyreData (size_id)');
  26. $this->addSql('CREATE INDEX IDX_F603601B84337261 ON TyreData (index_id)');
  27. $this->addSql('CREATE INDEX IDX_F603601B7975B7E7 ON TyreData (model_id)');
  28. $this->addSql('CREATE INDEX IDX_F603601B44DE2601 ON TyreData (cai_id)');
  29. }
  30.  
  31. public function down(Schema $schema)
  32. {
  33. // this down() migration is auto-generated, please modify it to your needs
  34. $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
  35.  
  36. $this->addSql('ALTER TABLE TyreData DROP FOREIGN KEY FK_F603601B44F5D008');
  37. $this->addSql('ALTER TABLE TyreData DROP FOREIGN KEY FK_F603601B498DA827');
  38. $this->addSql('ALTER TABLE TyreData DROP FOREIGN KEY FK_F603601B84337261');
  39. $this->addSql('ALTER TABLE TyreData DROP FOREIGN KEY FK_F603601B7975B7E7');
  40. $this->addSql('ALTER TABLE TyreData DROP FOREIGN KEY FK_F603601B44DE2601');
  41. $this->addSql('DROP INDEX IDX_F603601B44F5D008 ON TyreData');
  42. $this->addSql('DROP INDEX IDX_F603601B498DA827 ON TyreData');
  43. $this->addSql('DROP INDEX IDX_F603601B84337261 ON TyreData');
  44. $this->addSql('DROP INDEX IDX_F603601B7975B7E7 ON TyreData');
  45. $this->addSql('DROP INDEX IDX_F603601B44DE2601 ON TyreData');
  46. $this->addSql('ALTER TABLE TyreData CHANGE id id INT NOT NULL');
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement