Merge branch 'sf4' of framagit.org:Chill-project/Chill-Main into sf4

This commit is contained in:
Tchama 2020-07-31 15:59:55 +02:00
commit 544bd66000
9 changed files with 37 additions and 25 deletions

View File

@ -2,7 +2,7 @@
namespace Application\Migrations; namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
/** /**
@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\Schema;
*/ */
class Version20141128194409 extends AbstractMigration class Version20141128194409 extends AbstractMigration
{ {
public function up(Schema $schema) public function up(Schema $schema): void
{ {
$this->addSql("CREATE TABLE Country (id INT NOT NULL, name JSON NOT NULL, countryCode VARCHAR(3) NOT NULL, PRIMARY KEY(id));"); $this->addSql("CREATE TABLE Country (id INT NOT NULL, name JSON NOT NULL, countryCode VARCHAR(3) NOT NULL, PRIMARY KEY(id));");
$this->addSql("CREATE TABLE centers (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id));"); $this->addSql("CREATE TABLE centers (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id));");
@ -48,7 +48,7 @@ class Version20141128194409 extends AbstractMigration
$this->addSql("ALTER TABLE user_groupcenter ADD CONSTRAINT FK_33FFE54A7EC2FA68 FOREIGN KEY (groupcenter_id) REFERENCES group_centers (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;"); $this->addSql("ALTER TABLE user_groupcenter ADD CONSTRAINT FK_33FFE54A7EC2FA68 FOREIGN KEY (groupcenter_id) REFERENCES group_centers (id) ON DELETE CASCADE 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 // this down() migration is auto-generated, please modify it to your needs

View File

@ -2,7 +2,7 @@
namespace Application\Migrations; namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMapping;
@ -28,7 +28,7 @@ class Version20150821105642 extends AbstractMigration implements
/** /**
* @param Schema $schema * @param Schema $schema
*/ */
public function up(Schema $schema) public function up(Schema $schema): void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
@ -39,8 +39,20 @@ class Version20150821105642 extends AbstractMigration implements
} }
public function postUp(Schema $schema) public function postUp(Schema $schema): void
{ {
/*
* 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
*/
return;
//transform data from groupcenter_permissionsgroup table //transform data from groupcenter_permissionsgroup table
$em = $this->container->get('doctrine.orm.entity_manager'); $em = $this->container->get('doctrine.orm.entity_manager');
@ -110,7 +122,7 @@ class Version20150821105642 extends AbstractMigration implements
/** /**
* @param Schema $schema * @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\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

View File

@ -2,7 +2,7 @@
namespace Application\Migrations; namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
/** /**
@ -14,7 +14,7 @@ class Version20150821122935 extends AbstractMigration
/** /**
* @param Schema $schema * @param Schema $schema
*/ */
public function up(Schema $schema) public function up(Schema $schema): void
{ {
$this->addSql('DROP TABLE groupcenter_permissionsgroup'); $this->addSql('DROP TABLE groupcenter_permissionsgroup');
@ -25,7 +25,7 @@ class Version20150821122935 extends AbstractMigration
/** /**
* @param Schema $schema * @param Schema $schema
*/ */
public function down(Schema $schema) public function down(Schema $schema): void
{ {
$this->addSql('ALTER TABLE group_centers ALTER permissionsGroup_id SET DEFAULT NULL'); $this->addSql('ALTER TABLE group_centers ALTER permissionsGroup_id SET DEFAULT NULL');
$this->addSql('CREATE TABLE groupcenter_permissionsgroup (groupcenter_id INT NOT NULL, permissionsgroup_id INT NOT NULL, PRIMARY KEY(groupcenter_id, permissionsgroup_id))'); $this->addSql('CREATE TABLE groupcenter_permissionsgroup (groupcenter_id INT NOT NULL, permissionsgroup_id INT NOT NULL, PRIMARY KEY(groupcenter_id, permissionsgroup_id))');

View File

@ -2,7 +2,7 @@
namespace Application\Migrations; namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
/** /**
@ -13,7 +13,7 @@ class Version20160310122322 extends AbstractMigration
/** /**
* @param Schema $schema * @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->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
@ -52,7 +52,7 @@ class Version20160310122322 extends AbstractMigration
/** /**
* @param Schema $schema * @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\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

View File

@ -2,7 +2,7 @@
namespace Application\Migrations; namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
/** /**

View File

@ -2,7 +2,7 @@
namespace Application\Migrations; namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
/** /**