mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	adapt migrations files to flex
This commit is contained in:
		@@ -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 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 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;");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema)
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        // this down() migration is auto-generated, please modify it to your needs
 | 
			
		||||
 | 
			
		||||
@@ -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\ContainerInterface;
 | 
			
		||||
use Doctrine\ORM\Query\ResultSetMapping;
 | 
			
		||||
@@ -28,7 +28,7 @@ class Version20150821105642 extends AbstractMigration implements
 | 
			
		||||
    /**
 | 
			
		||||
     * @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->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
 | 
			
		||||
        $em = $this->container->get('doctrine.orm.entity_manager');
 | 
			
		||||
        
 | 
			
		||||
@@ -110,7 +122,7 @@ class Version20150821105642 extends AbstractMigration implements
 | 
			
		||||
    /**
 | 
			
		||||
     * @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\'.');
 | 
			
		||||
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
namespace Application\Migrations;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Migrations\AbstractMigration;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -14,7 +14,7 @@ class Version20150821122935 extends AbstractMigration
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Schema $schema
 | 
			
		||||
     */
 | 
			
		||||
    public function up(Schema $schema)
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        $this->addSql('DROP TABLE groupcenter_permissionsgroup');
 | 
			
		||||
@@ -25,7 +25,7 @@ class Version20150821122935 extends AbstractMigration
 | 
			
		||||
    /**
 | 
			
		||||
     * @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('CREATE TABLE groupcenter_permissionsgroup (groupcenter_id INT NOT NULL, permissionsgroup_id INT NOT NULL, PRIMARY KEY(groupcenter_id, permissionsgroup_id))');
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
namespace Application\Migrations;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Migrations\AbstractMigration;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -13,7 +13,7 @@ class Version20160310122322 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\'.');
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +52,7 @@ class Version20160310122322 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\'.');
 | 
			
		||||
 | 
			
		||||
@@ -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;
 | 
			
		||||
 */
 | 
			
		||||
final class Version20180703191509 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function up(Schema $schema) : void
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +23,7 @@ final class Version20180703191509 extends AbstractMigration
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema) : void
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
 | 
			
		||||
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
namespace Application\Migrations;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Migrations\AbstractMigration;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -11,7 +11,7 @@ use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
 */
 | 
			
		||||
final class Version20180709181423 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function up(Schema $schema) : void
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
 | 
			
		||||
 | 
			
		||||
@@ -69,7 +69,7 @@ SQL
 | 
			
		||||
            );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema) : void
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
 | 
			
		||||
        
 | 
			
		||||
@@ -10,14 +10,14 @@ use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
 */
 | 
			
		||||
final class Version20180905101426 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function up(Schema $schema) : void
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE permission_groups ADD flags JSONB DEFAULT \'[]\' NOT NULL');
 | 
			
		||||
        $this->addSql('ALTER TABLE group_centers ALTER permissionsgroup_id DROP NOT NULL');
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema) : void
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE permission_groups DROP COLUMN flags');
 | 
			
		||||
        $this->addSql('ALTER TABLE group_centers ALTER permissionsgroup_id SET DEFAULT NULL'); 
 | 
			
		||||
@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
 */
 | 
			
		||||
final class Version20180911093642 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function up(Schema $schema) : void
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql("DROP TRIGGER canonicalize_user_on_update ON users");
 | 
			
		||||
        
 | 
			
		||||
@@ -26,7 +26,7 @@ SQL
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema) : void
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql("DROP TRIGGER canonicalize_user_on_update ON users");
 | 
			
		||||
            
 | 
			
		||||
@@ -10,12 +10,12 @@ use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
 */
 | 
			
		||||
final class Version20200422122715 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function up(Schema $schema) : void
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_main_address ADD isNoAddress BOOLEAN NOT NULL DEFAULT FALSE');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema) : void
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_main_address DROP isNoAddress');
 | 
			
		||||
    }
 | 
			
		||||
		Reference in New Issue
	
	Block a user