migrations/Version20261012134606.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20261012134606 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE CustomerModule ADD CONSTRAINT FK_82E1C2619395C3F3 FOREIGN KEY (customer_id) REFERENCES Customer (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE UserBlockedModule ADD CONSTRAINT FK_71BBE9DAA76ED395 FOREIGN KEY (user_id) REFERENCES User (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE Agency ADD isFranchise TINYINT(1) DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE Customer ADD agency_id INT DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE Customer ADD CONSTRAINT FK_784FEC5FCDEADB2A FOREIGN KEY (agency_id) REFERENCES Agency (id)');
  25.         $this->addSql('CREATE INDEX IDX_784FEC5FCDEADB2A ON Customer (agency_id)');
  26.         $this->addSql('ALTER TABLE MenuItemFront ADD module VARCHAR(32) DEFAULT NULL');
  27.         $this->addSql('DROP INDEX general_translations_lookup_idx ON ext_translations');
  28.         $this->addSql('DROP INDEX translations_lookup_idx ON ext_translations');
  29.         $this->addSql('DROP INDEX lookup_unique_idx ON ext_translations');
  30.         $this->addSql('CREATE UNIQUE INDEX lookup_unique_idx ON ext_translations (foreign_key, locale, object_class, field)');
  31.     }
  32.     public function down(Schema $schema): void
  33.     {
  34.         // this down() migration is auto-generated, please modify it to your needs
  35.         $this->addSql('ALTER TABLE CustomerModule DROP FOREIGN KEY FK_82E1C2619395C3F3');
  36.         $this->addSql('ALTER TABLE UserBlockedModule DROP FOREIGN KEY FK_71BBE9DAA76ED395');
  37.         $this->addSql('DROP TABLE CustomerModule');
  38.         $this->addSql('DROP TABLE UserBlockedModule');
  39.         $this->addSql('ALTER TABLE Agency DROP isFranchise');
  40.         $this->addSql('ALTER TABLE Customer DROP FOREIGN KEY FK_784FEC5FCDEADB2A');
  41.         $this->addSql('DROP INDEX IDX_784FEC5FCDEADB2A ON Customer');
  42.         $this->addSql('ALTER TABLE Customer DROP agency_id');
  43.         $this->addSql('ALTER TABLE MenuItemFront DROP module');
  44.         $this->addSql('DROP INDEX lookup_unique_idx ON ext_translations');
  45.         $this->addSql('CREATE INDEX general_translations_lookup_idx ON ext_translations (object_class, foreign_key)');
  46.         $this->addSql('CREATE INDEX translations_lookup_idx ON ext_translations (locale, object_class, foreign_key)');
  47.         $this->addSql('CREATE UNIQUE INDEX lookup_unique_idx ON ext_translations (locale, object_class, field, foreign_key)');
  48.     }
  49. }