migrations/Version20251016161114.php line 1

Open in your IDE?
  1. <?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 Version20251016161114 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(<<<'SQL'
                CREATE TABLE user_entite (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, customer_id INT DEFAULT NULL, distributeur_id INT DEFAULT NULL, group_distributeur_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, entiteType ENUM('UNDEFINED', 'GARAGE', 'DISTRIBUTEUR', 'GROUPE_DISTRIBUTEUR', 'AUTRE') DEFAULT 'UNDEFINED' NOT NULL COMMENT '(DC2Type:UserEntiteType)', entite_id INT DEFAULT NULL, is_default TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', INDEX IDX_7F7B031AA76ED395 (user_id), INDEX IDX_7F7B031A9395C3F3 (customer_id), INDEX IDX_7F7B031A29EB7ACA (distributeur_id), INDEX IDX_7F7B031A9778E713 (group_distributeur_id), INDEX IDX_7F7B031AB03A8386 (created_by_id), INDEX IDX_7F7B031A896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite ADD CONSTRAINT FK_7F7B031AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite ADD CONSTRAINT FK_7F7B031A9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite ADD CONSTRAINT FK_7F7B031A29EB7ACA FOREIGN KEY (distributeur_id) REFERENCES distributeur (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite ADD CONSTRAINT FK_7F7B031A9778E713 FOREIGN KEY (group_distributeur_id) REFERENCES group_distributeur (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite ADD CONSTRAINT FK_7F7B031AB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite ADD CONSTRAINT FK_7F7B031A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)
            SQL);
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite DROP FOREIGN KEY FK_7F7B031AA76ED395
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite DROP FOREIGN KEY FK_7F7B031A9395C3F3
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite DROP FOREIGN KEY FK_7F7B031A29EB7ACA
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite DROP FOREIGN KEY FK_7F7B031A9778E713
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite DROP FOREIGN KEY FK_7F7B031AB03A8386
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user_entite DROP FOREIGN KEY FK_7F7B031A896DBBDE
            SQL);
            $this->addSql(<<<'SQL'
                DROP TABLE user_entite
            SQL);
        }
    }