Merge pull request #5216 from christianbeeznest/GH-5212
	
		
	
				
					
				
			User: Remove deprecated user.enabled field - refs #5212pull/5217/head
						commit
						df65d9b8ef
					
				@ -0,0 +1,34 @@ | 
				
			||||
<?php | 
				
			||||
 | 
				
			||||
declare(strict_types=1); | 
				
			||||
 | 
				
			||||
/* For licensing terms, see /license.txt */ | 
				
			||||
 | 
				
			||||
namespace Chamilo\CoreBundle\Migrations\Schema\V200; | 
				
			||||
 | 
				
			||||
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; | 
				
			||||
use Doctrine\DBAL\Schema\Schema; | 
				
			||||
 | 
				
			||||
class Version20240306133140 extends AbstractMigrationChamilo | 
				
			||||
{ | 
				
			||||
    public function getDescription(): string | 
				
			||||
    { | 
				
			||||
        return 'Remove deprecated and confusing user.enabled field'; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public function up(Schema $schema): void | 
				
			||||
    { | 
				
			||||
        $table = $schema->getTable('user'); | 
				
			||||
        if ($table->hasColumn('enabled')) { | 
				
			||||
            $this->addSql('ALTER TABLE user DROP enabled'); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public function down(Schema $schema): void | 
				
			||||
    { | 
				
			||||
        $table = $schema->getTable('user'); | 
				
			||||
        if (!$table->hasColumn('enabled')) { | 
				
			||||
            $this->addSql('ALTER TABLE user ADD enabled TINYINT(1) NOT NULL'); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue