diff --git a/Resources/migrations/Version20141129012050.php b/migrations/Version20141129012050.php similarity index 91% rename from Resources/migrations/Version20141129012050.php rename to migrations/Version20141129012050.php index a87ab505c..6e2aaf750 100644 --- a/Resources/migrations/Version20141129012050.php +++ b/migrations/Version20141129012050.php @@ -2,7 +2,7 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; +use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /** @@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\Schema; */ class Version20141129012050 extends AbstractMigration { - public function up(Schema $schema) + public function up(Schema $schema): void { $this->addSql("CREATE SEQUENCE Report_id_seq INCREMENT BY 1 MINVALUE 1 START 1;"); $this->addSql("CREATE TABLE Report (id INT NOT NULL, user_id INT DEFAULT NULL, person_id INT DEFAULT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, scope VARCHAR(255) DEFAULT NULL, cFData JSON NOT NULL, cFGroup_id INT DEFAULT NULL, PRIMARY KEY(id));"); @@ -22,7 +22,7 @@ class Version20141129012050 extends AbstractMigration $this->addSql("ALTER TABLE Report ADD CONSTRAINT FK_C38372B216D2C9F0 FOREIGN KEY (cFGroup_id) REFERENCES CustomFieldsGroup (id) NOT DEFERRABLE INITIALLY IMMEDIATE;"); } - public function down(Schema $schema) + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs diff --git a/Resources/migrations/Version20150622233319.php b/migrations/Version20150622233319.php similarity index 87% rename from Resources/migrations/Version20150622233319.php rename to migrations/Version20150622233319.php index 7d4342a29..75ece3511 100644 --- a/Resources/migrations/Version20150622233319.php +++ b/migrations/Version20150622233319.php @@ -2,7 +2,7 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; +use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Scope; class Version20150622233319 extends AbstractMigration implements ContainerAwareInterface { + /** * * @var ContainerInterface @@ -34,13 +35,23 @@ class Version20150622233319 extends AbstractMigration /** * @param Schema $schema */ - public function up(Schema $schema) + public function up(Schema $schema): void { $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->addSql('ALTER TABLE report ADD scope_id INT DEFAULT NULL'); + /* + * Before the upgrade to symfony version 4, this code worked. + * + * But it doesn't work any more after the migration and currently this + * code should note be necessary. + * + * This code is kept for reference, and may be re-activated if needed, but + * the probability that this will happens is near 0 + * + //add a default scope $scopes = $this->container->get('doctrine.orm.default_entity_manager') ->getRepository('ChillMainBundle:Scope') @@ -73,7 +84,7 @@ class Version20150622233319 extends AbstractMigration //default scope is the newly-created one $defaultScopeId = $scope->getId(); } - } + }*/ $this->addSql('ALTER TABLE report DROP scope'); //before this migration, scope was never used $this->addSql('ALTER TABLE report ADD CONSTRAINT FK_report_scope ' @@ -92,7 +103,7 @@ class Version20150622233319 extends AbstractMigration /** * @param Schema $schema */ - public function down(Schema $schema) + public function down(Schema $schema): void { $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');