Version20171107185545.php 806 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Application\Migrations;
  3. use Doctrine\DBAL\Migrations\AbstractMigration;
  4. use Doctrine\DBAL\Schema\Schema;
  5. class Version20171107185545 extends AbstractMigration
  6. {
  7. /**
  8. * @param Schema $schema
  9. */
  10. public function up(Schema $schema)
  11. {
  12. $this->addsql(
  13. "UPDATE nap AS n
  14. JOIN olt AS o ON o.name = JSON_EXTRACT(n.extra_data, '$.olt')
  15. SET n.link = JSON_EXTRACT(n.extra_data, '$.link'),
  16. n.slot = JSON_EXTRACT(n.extra_data, '$.slot'),
  17. n.olt_id = o.id
  18. WHERE n.link = 0 AND n.slot = 0;"
  19. );
  20. }
  21. /**
  22. * @param Schema $schema
  23. */
  24. public function down(Schema $schema)
  25. {
  26. // this down() migration is auto-generated, please modify it to your needs
  27. }
  28. }