<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221026153759 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE users DROP FOREIGN KEY FK_1483A5E9D60322AC');
$this->addSql('DROP TABLE user_permission_roles');
$this->addSql('DROP INDEX IDX_1483A5E9D60322AC ON users');
$this->addSql('ALTER TABLE users ADD roles LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', DROP role_id');
}
public function down(Schema $schema): void
{
$this->addSql('CREATE TABLE user_permission_roles (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'nazwa\', code VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'kod\', created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX user_permission_roles_code_index (code), INDEX user_permission_roles_name_index (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE users ADD role_id BIGINT UNSIGNED DEFAULT NULL, DROP roles');
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E9D60322AC FOREIGN KEY (role_id) REFERENCES user_permission_roles (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_1483A5E9D60322AC ON users (role_id)');
}
}