| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Application\Migrations; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Azine\MailgunWebhooksBundle\Entity\MailgunEvent; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Azine\MailgunWebhooksBundle\Entity\MailgunMessageSummary; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Doctrine\DBAL\Migrations\AbortMigrationException; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Doctrine\DBAL\Migrations\AbstractMigration; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Doctrine\DBAL\Schema\Schema; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Doctrine\ORM\EntityManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Symfony\Component\DependencyInjection\ContainerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * Move & rename this migration to your doctrine:migrations directory and run it to upgrade the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * db tables and generate the MessageSummary-Objects from the MailgunEvents in your database. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * Add MessageSummary Entity to keep track and summarize what happened with a sent email. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * Rename table email_traffic_statistics to mailgun_email_traffic_statistics | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | class Version20201123090099 extends AbstractMigration implements ContainerAwareInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     /** @var EntityManager */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     private $manager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public function setContainer(ContainerInterface $container = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $this->manager = $container->get('doctrine.orm.entity_manager'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @param Schema $schema | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * @throws AbortMigrationException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     public function up(Schema $schema) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $this->abortIf('mysql' != $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         $this->addSql('RENAME TABLE email_traffic_statistics TO mailgun_email_traffic_statistics'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         $this->addSql('CREATE TABLE mailgun_message_summary (id VARCHAR(255) NOT NULL, fromAddress VARCHAR(255) NOT NULL, toAddress LONGTEXT NOT NULL, firstOpened DATETIME DEFAULT NULL, lastOpened DATETIME DEFAULT NULL, openCount INT NOT NULL, sendDate DATETIME NOT NULL, deliveryStatus VARCHAR(95) NOT NULL, senderIp VARCHAR(15) NOT NULL, subject LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $this->addSql('ALTER TABLE mailgun_event ADD messageId VARCHAR(255) DEFAULT NULL, CHANGE message_id message_id VARCHAR(255) NOT NULL, ADD sender VARCHAR(255) NOT NULL'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $this->addSql('ALTER TABLE mailgun_event ADD CONSTRAINT FK_1271933FA4C3A0DA FOREIGN KEY (messageId) REFERENCES mailgun_message_summary (id) ON DELETE CASCADE'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $this->addSql('CREATE INDEX IDX_1271933FA4C3A0DA ON mailgun_event (messageId)'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * @param Schema $schema | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * @throws \Doctrine\ORM\OptimisticLockException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     public function postUp(Schema $schema) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         foreach($this->manager->getRepository(MailgunEvent::class)->findAll() as $event){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             $this->manager->getRepository(MailgunMessageSummary::class)->createOrUpdateMessageSummary($event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |             $this->manager->flush(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * @param Schema $schema | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * @throws AbortMigrationException | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 60 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |     public function down(Schema $schema) | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |         $this->abortIf('mysql' != $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.'); | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |         $this->addSql('RENAME TABLE mailgun_email_traffic_statistics TO email_traffic_statistics'); | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |         $this->addSql('DROP INDEX IDX_1271933FA4C3A0DA ON mailgun_event'); | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |         $this->addSql('ALTER TABLE mailgun_event DROP FOREIGN KEY FK_1271933FA4C3A0DA'); | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |         $this->addSql('ALTER TABLE mailgun_event DROP sender, DROP messageId, CHANGE message_id message_id VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci'); | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |         $this->addSql('DROP TABLE mailgun_message_summary'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 70 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |  | 
            
                        
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths