migrations/Version20220613135047.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 Version20220613135047 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 sewing (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, level VARCHAR(255) DEFAULT NULL, price_ht DOUBLE PRECISION DEFAULT NULL, tva DOUBLE PRECISION DEFAULT NULL, description LONGTEXT DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, picture_alt VARCHAR(255) DEFAULT NULL, published TINYINT(1) DEFAULT NULL, date_publication DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE sewing_sewing (sewing_source INT NOT NULL, sewing_target INT NOT NULL, INDEX IDX_9C6012DA370A9100 (sewing_source), INDEX IDX_9C6012DA2EEFC18F (sewing_target), PRIMARY KEY(sewing_source, sewing_target)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE sewing_galery (id INT AUTO_INCREMENT NOT NULL, sewing_id INT DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, picture_alt VARCHAR(255) DEFAULT NULL, INDEX IDX_63DDBD53A8EBEFE2 (sewing_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('ALTER TABLE sewing_sewing ADD CONSTRAINT FK_9C6012DA370A9100 FOREIGN KEY (sewing_source) REFERENCES sewing (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE sewing_sewing ADD CONSTRAINT FK_9C6012DA2EEFC18F FOREIGN KEY (sewing_target) REFERENCES sewing (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE sewing_galery ADD CONSTRAINT FK_63DDBD53A8EBEFE2 FOREIGN KEY (sewing_id) REFERENCES sewing (id)');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('ALTER TABLE sewing_sewing DROP FOREIGN KEY FK_9C6012DA370A9100');
            $this->addSql('ALTER TABLE sewing_sewing DROP FOREIGN KEY FK_9C6012DA2EEFC18F');
            $this->addSql('ALTER TABLE sewing_galery DROP FOREIGN KEY FK_63DDBD53A8EBEFE2');
            $this->addSql('DROP TABLE sewing');
            $this->addSql('DROP TABLE sewing_sewing');
            $this->addSql('DROP TABLE sewing_galery');
        }
    }