Centralized permission updated message for migrations.

This commit is contained in:
Jan Böhmer 2020-06-14 21:17:57 +02:00
parent 74e4c4d0d1
commit 00689b35ce
4 changed files with 17 additions and 3 deletions

View file

@ -11,6 +11,8 @@ use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
abstract class AbstractMultiPlatformMigration extends AbstractMigration
{
protected $permissions_updated = false;
public function up(Schema $schema): void
{
$db_type = $this->connection->getDatabasePlatform()->getName();
@ -70,6 +72,18 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
return '$2y$10$36AnqCBS.YnHlVdM4UQ0oOCV7BjU7NmE0qnAVEex65AyZw1cbcEjq';
}
public function printPermissionUpdateMessage(): void
{
$this->permissions_updated = true;
//$this->write('<question>[!!!] Permissions were updated! Please check if they fit your expectations!</question>');
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$this->write('<question>[!!!] Permissions were updated! Please check if they fit your expectations!</question>');
}
abstract public function mySQLUp(Schema $schema): void;
abstract public function mySQLDown(Schema $schema): void;

View file

@ -68,7 +68,7 @@ final class Version20190913141126 extends AbstractMultiPlatformMigration
$this->addSql($sql);
$this->write('[!!!] Permissions were updated! Please check if they fit your expectations!');
$this->printPermissionUpdateMessage();
}
public function mySQLDown(Schema $schema): void

View file

@ -36,7 +36,7 @@ final class Version20200311204104 extends AbstractMultiPlatformMigration
'SET perms_parts_parameters = 681 WHERE (id = 2 AND name = "readonly");';
$this->addSql($sql);
$this->write('<question>[!!!] Permissions were updated! Please check if they fit your expectations!</question>');
$this->printPermissionUpdateMessage();
}
public function mySQLDown(Schema $schema): void

View file

@ -136,7 +136,7 @@ EOD;
EOD;
$this->addSql($sql);
$this->printPermissionUpdateMessage();
}
public function sqLiteDown(Schema $schema): void