<?php
declare(strict_types=1);
namespace EckinoxSecurityMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220808092422 extends AbstractMigration
{
public function getDescription(): string
{
return 'Migrate privileges in a JSON object format to an array format.';
}
public function up(Schema $schema): void
{
$this->addSql('UPDATE `eckinox_users` SET `privileges` = `privileges`->"$.*" WHERE `privileges` IS NOT NULL AND `privileges`->"$.*" IS NOT NULL');
$this->addSql('UPDATE `eckinox_app_users` SET `privileges` = `privileges`->"$.*" WHERE `privileges` IS NOT NULL AND `privileges`->"$.*" IS NOT NULL');
$this->addSql('UPDATE `eckinox_user_groups` SET `privileges` = `privileges`->"$.*" WHERE `privileges` IS NOT NULL AND `privileges`->"$.*" IS NOT NULL');
$this->addSql('UPDATE `eckinox_app_user_groups` SET `privileges` = `privileges`->"$.*" WHERE `privileges` IS NOT NULL AND `privileges`->"$.*" IS NOT NULL');
}
public function down(Schema $schema): void
{
}
}