<?php
declare(strict_types=1);
namespace EckinoxSecurityMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210823190951 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE eckinox_app_user_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, privileges JSON NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE eckinox_app_users (id INT AUTO_INCREMENT NOT NULL, user_group_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, email VARCHAR(180) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, roles JSON NOT NULL, privileges JSON NOT NULL, password VARCHAR(255) NOT NULL, archived TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_66189750E7927C74 (email), INDEX IDX_661897501ED93D47 (user_group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE eckinox_app_users ADD CONSTRAINT FK_661897501ED93D47 FOREIGN KEY (user_group_id) REFERENCES eckinox_app_user_groups (id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE eckinox_app_users DROP FOREIGN KEY FK_661897501ED93D47');
$this->addSql('DROP TABLE eckinox_app_user_groups');
$this->addSql('DROP TABLE eckinox_app_users');
}
}