<?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 Version20231011094300 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 newsletter (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, company VARCHAR(255) DEFAULT NULL, status TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE faq CHANGE question question LONGTEXT NOT NULL');
$this->addSql('ALTER TABLE permission_role CHANGE permission_id permission_id INT DEFAULT NULL, CHANGE role_id role_id INT DEFAULT NULL, CHANGE created_at created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE updated_at updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE permission_role RENAME INDEX permission_id TO IDX_6A711CAFED90CCA');
$this->addSql('ALTER TABLE permission_role RENAME INDEX role_id TO IDX_6A711CAD60322AC');
$this->addSql('ALTER TABLE permission_user CHANGE permission_id permission_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE created_at created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE updated_at updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE permission_user RENAME INDEX permission_id TO IDX_DC5D4DE9FED90CCA');
$this->addSql('ALTER TABLE permission_user RENAME INDEX user_id TO IDX_DC5D4DE9A76ED395');
$this->addSql('ALTER TABLE permissions CHANGE created_at created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE updated_at updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE deleted_at deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE user_role DROP INDEX UNIQ_54FCD59F9D86650F, ADD INDEX IDX_2DE8C6A3A76ED395 (user_id)');
$this->addSql('ALTER TABLE user_role MODIFY id INT NOT NULL');
$this->addSql('DROP INDEX `primary` ON user_role');
$this->addSql('ALTER TABLE user_role DROP id');
$this->addSql('ALTER TABLE user_role ADD PRIMARY KEY (user_id, role_id)');
$this->addSql('ALTER TABLE user_role RENAME INDEX idx_54fcd59fa76ed395 TO IDX_2DE8C6A3D60322AC');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE newsletter');
$this->addSql('ALTER TABLE faq CHANGE question question TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE permission_role CHANGE permission_id permission_id INT NOT NULL, CHANGE role_id role_id INT NOT NULL, CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE permission_role RENAME INDEX idx_6a711cafed90cca TO permission_id');
$this->addSql('ALTER TABLE permission_role RENAME INDEX idx_6a711cad60322ac TO role_id');
$this->addSql('ALTER TABLE permission_user CHANGE permission_id permission_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE permission_user RENAME INDEX idx_dc5d4de9fed90cca TO permission_id');
$this->addSql('ALTER TABLE permission_user RENAME INDEX idx_dc5d4de9a76ed395 TO user_id');
$this->addSql('ALTER TABLE permissions CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL, CHANGE deleted_at deleted_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE user_role DROP INDEX IDX_2DE8C6A3A76ED395, ADD UNIQUE INDEX UNIQ_54FCD59F9D86650F (user_id)');
$this->addSql('ALTER TABLE user_role ADD id INT AUTO_INCREMENT NOT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)');
$this->addSql('ALTER TABLE user_role RENAME INDEX idx_2de8c6a3d60322ac TO IDX_54FCD59FA76ED395');
}
}