<?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 Version20230322072517 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 order_supplement (id INT AUTO_INCREMENT NOT NULL, related_order_id INT NOT NULL, supplement_type_id INT NOT NULL, supplement DOUBLE PRECISION NOT NULL, INDEX IDX_B2808E9C2B1C2395 (related_order_id), INDEX IDX_B2808E9C9918F965 (supplement_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE supplement_type (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, bexio_article_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE order_supplement ADD CONSTRAINT FK_B2808E9C2B1C2395 FOREIGN KEY (related_order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE order_supplement ADD CONSTRAINT FK_B2808E9C9918F965 FOREIGN KEY (supplement_type_id) REFERENCES supplement_type (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE order_supplement DROP FOREIGN KEY FK_B2808E9C2B1C2395');
$this->addSql('ALTER TABLE order_supplement DROP FOREIGN KEY FK_B2808E9C9918F965');
$this->addSql('DROP TABLE order_supplement');
$this->addSql('DROP TABLE supplement_type');
}
}