<?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 Version20220419111852 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 sw_licence (id INT AUTO_INCREMENT NOT NULL, copyright VARCHAR(63) NOT NULL, relative DOUBLE PRECISION DEFAULT NULL, absolute DOUBLE PRECISION DEFAULT NULL, maximal DOUBLE PRECISION DEFAULT NULL, code VARCHAR(3) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE sw_product ADD sw_licence_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE sw_product ADD CONSTRAINT FK_A816C24876BB78EE FOREIGN KEY (sw_licence_id) REFERENCES sw_licence (id)');
$this->addSql('CREATE INDEX IDX_A816C24876BB78EE ON sw_product (sw_licence_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sw_product DROP FOREIGN KEY FK_A816C24876BB78EE');
$this->addSql('DROP TABLE sw_licence');
$this->addSql('DROP INDEX IDX_A816C24876BB78EE ON sw_product');
$this->addSql('ALTER TABLE sw_product DROP sw_licence_id');
}
}