migrations/Version20250930151300.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 Version20250930151300 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 demande_prestation_kit (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, code_reference_kit VARCHAR(10) NOT NULL, designation_kit VARCHAR(255) NOT NULL, montant_kit_ht DOUBLE PRECISION NOT NULL, distributor_discount_rate DOUBLE PRECISION NOT NULL, info_note LONGTEXT DEFAULT NULL, description_kit LONGTEXT DEFAULT NULL, kit_img_name VARCHAR(255) NOT NULL, is_active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', INDEX IDX_9409147EB03A8386 (created_by_id), INDEX IDX_9409147E896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
            SQL);
            $this->addSql(<<<'SQL'
                CREATE TABLE kit_complementaire_type_prestation (demande_prestation_kit_id INT NOT NULL, type_prestation_id INT NOT NULL, INDEX IDX_E5900A756F5CEF0F (demande_prestation_kit_id), INDEX IDX_E5900A75EEA87261 (type_prestation_id), PRIMARY KEY(demande_prestation_kit_id, type_prestation_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
            SQL);
            $this->addSql(<<<'SQL'
                CREATE TABLE demande_prestation_kit_item (id INT AUTO_INCREMENT NOT NULL, demande_prestation_id INT NOT NULL, kit_id INT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, quantite INT NOT NULL, prix_unitaire_ht DOUBLE PRECISION NOT NULL, taux_remise_distributeur DOUBLE PRECISION NOT NULL, taux_remise_garage DOUBLE PRECISION NOT NULL, note_info_snapshot LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', INDEX IDX_C15BBFF22EC294E4 (demande_prestation_id), INDEX IDX_C15BBFF23A8E60EF (kit_id), INDEX IDX_C15BBFF2B03A8386 (created_by_id), INDEX IDX_C15BBFF2896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit ADD CONSTRAINT FK_9409147EB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit ADD CONSTRAINT FK_9409147E896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE kit_complementaire_type_prestation ADD CONSTRAINT FK_E5900A756F5CEF0F FOREIGN KEY (demande_prestation_kit_id) REFERENCES demande_prestation_kit (id) ON DELETE CASCADE
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE kit_complementaire_type_prestation ADD CONSTRAINT FK_E5900A75EEA87261 FOREIGN KEY (type_prestation_id) REFERENCES type_prestation (id) ON DELETE CASCADE
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item ADD CONSTRAINT FK_C15BBFF22EC294E4 FOREIGN KEY (demande_prestation_id) REFERENCES demande_prestation (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item ADD CONSTRAINT FK_C15BBFF23A8E60EF FOREIGN KEY (kit_id) REFERENCES demande_prestation_kit (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item ADD CONSTRAINT FK_C15BBFF2B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item ADD CONSTRAINT FK_C15BBFF2896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation CHANGE modele_vehicule modele_vehicule VARCHAR(255) NOT NULL
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE famille_prestation ADD created_by_id INT DEFAULT NULL, ADD updated_by_id INT DEFAULT NULL, ADD famille_img_name VARCHAR(255) DEFAULT NULL, ADD created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', ADD updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)'
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE famille_prestation ADD CONSTRAINT FK_A53C1207B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE famille_prestation ADD CONSTRAINT FK_A53C1207896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                CREATE INDEX IDX_A53C1207B03A8386 ON famille_prestation (created_by_id)
            SQL);
            $this->addSql(<<<'SQL'
                CREATE INDEX IDX_A53C1207896DBBDE ON famille_prestation (updated_by_id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE type_prestation ADD created_by_id INT DEFAULT NULL, ADD updated_by_id INT DEFAULT NULL
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE type_prestation ADD CONSTRAINT FK_4CCB5988B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE type_prestation ADD CONSTRAINT FK_4CCB5988896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)
            SQL);
            $this->addSql(<<<'SQL'
                CREATE INDEX IDX_4CCB5988B03A8386 ON type_prestation (created_by_id)
            SQL);
            $this->addSql(<<<'SQL'
                CREATE INDEX IDX_4CCB5988896DBBDE ON type_prestation (updated_by_id)
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user ADD last_login_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)'
            SQL);
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit DROP FOREIGN KEY FK_9409147EB03A8386
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit DROP FOREIGN KEY FK_9409147E896DBBDE
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE kit_complementaire_type_prestation DROP FOREIGN KEY FK_E5900A756F5CEF0F
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE kit_complementaire_type_prestation DROP FOREIGN KEY FK_E5900A75EEA87261
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item DROP FOREIGN KEY FK_C15BBFF22EC294E4
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item DROP FOREIGN KEY FK_C15BBFF23A8E60EF
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item DROP FOREIGN KEY FK_C15BBFF2B03A8386
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation_kit_item DROP FOREIGN KEY FK_C15BBFF2896DBBDE
            SQL);
            $this->addSql(<<<'SQL'
                DROP TABLE demande_prestation_kit
            SQL);
            $this->addSql(<<<'SQL'
                DROP TABLE kit_complementaire_type_prestation
            SQL);
            $this->addSql(<<<'SQL'
                DROP TABLE demande_prestation_kit_item
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE famille_prestation DROP FOREIGN KEY FK_A53C1207B03A8386
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE famille_prestation DROP FOREIGN KEY FK_A53C1207896DBBDE
            SQL);
            $this->addSql(<<<'SQL'
                DROP INDEX IDX_A53C1207B03A8386 ON famille_prestation
            SQL);
            $this->addSql(<<<'SQL'
                DROP INDEX IDX_A53C1207896DBBDE ON famille_prestation
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE famille_prestation DROP created_by_id, DROP updated_by_id, DROP famille_img_name, DROP created_at, DROP updated_at
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE demande_prestation CHANGE modele_vehicule modele_vehicule VARCHAR(100) NOT NULL
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE type_prestation DROP FOREIGN KEY FK_4CCB5988B03A8386
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE type_prestation DROP FOREIGN KEY FK_4CCB5988896DBBDE
            SQL);
            $this->addSql(<<<'SQL'
                DROP INDEX IDX_4CCB5988B03A8386 ON type_prestation
            SQL);
            $this->addSql(<<<'SQL'
                DROP INDEX IDX_4CCB5988896DBBDE ON type_prestation
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE type_prestation DROP created_by_id, DROP updated_by_id
            SQL);
            $this->addSql(<<<'SQL'
                ALTER TABLE user DROP last_login_at
            SQL);
        }
    }