<?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 Version20261012134606 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 CustomerModule (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, module VARCHAR(32) NOT NULL, enabled TINYINT(1) DEFAULT 1 NOT NULL, creditLimit NUMERIC(20, 3) DEFAULT NULL, createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, INDEX IDX_82E1C2619395C3F3 (customer_id), UNIQUE INDEX customer_module_unique (customer_id, module), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE UserBlockedModule (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, module VARCHAR(32) NOT NULL, createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, INDEX IDX_71BBE9DAA76ED395 (user_id), UNIQUE INDEX user_blocked_module_unique (user_id, module), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE CustomerModule ADD CONSTRAINT FK_82E1C2619395C3F3 FOREIGN KEY (customer_id) REFERENCES Customer (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE UserBlockedModule ADD CONSTRAINT FK_71BBE9DAA76ED395 FOREIGN KEY (user_id) REFERENCES User (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE Agency ADD isFranchise TINYINT(1) DEFAULT NULL');
$this->addSql('ALTER TABLE Customer ADD agency_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE Customer ADD CONSTRAINT FK_784FEC5FCDEADB2A FOREIGN KEY (agency_id) REFERENCES Agency (id)');
$this->addSql('CREATE INDEX IDX_784FEC5FCDEADB2A ON Customer (agency_id)');
$this->addSql('ALTER TABLE MenuItemFront ADD module VARCHAR(32) DEFAULT NULL');
$this->addSql('DROP INDEX general_translations_lookup_idx ON ext_translations');
$this->addSql('DROP INDEX translations_lookup_idx ON ext_translations');
$this->addSql('DROP INDEX lookup_unique_idx ON ext_translations');
$this->addSql('CREATE UNIQUE INDEX lookup_unique_idx ON ext_translations (foreign_key, locale, object_class, field)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE CustomerModule DROP FOREIGN KEY FK_82E1C2619395C3F3');
$this->addSql('ALTER TABLE UserBlockedModule DROP FOREIGN KEY FK_71BBE9DAA76ED395');
$this->addSql('DROP TABLE CustomerModule');
$this->addSql('DROP TABLE UserBlockedModule');
$this->addSql('ALTER TABLE Agency DROP isFranchise');
$this->addSql('ALTER TABLE Customer DROP FOREIGN KEY FK_784FEC5FCDEADB2A');
$this->addSql('DROP INDEX IDX_784FEC5FCDEADB2A ON Customer');
$this->addSql('ALTER TABLE Customer DROP agency_id');
$this->addSql('ALTER TABLE MenuItemFront DROP module');
$this->addSql('DROP INDEX lookup_unique_idx ON ext_translations');
$this->addSql('CREATE INDEX general_translations_lookup_idx ON ext_translations (object_class, foreign_key)');
$this->addSql('CREATE INDEX translations_lookup_idx ON ext_translations (locale, object_class, foreign_key)');
$this->addSql('CREATE UNIQUE INDEX lookup_unique_idx ON ext_translations (locale, object_class, field, foreign_key)');
}
}