migrations/Version20230605124236.php line 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 Version20230605124236 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 licence (id INT AUTO_INCREMENT NOT NULL, module_id INT NOT NULL, name INT NOT NULL, commentaire VARCHAR(255) DEFAULT NULL, date DATETIME DEFAULT NULL, type VARCHAR(255) NOT NULL, prix INT DEFAULT NULL, INDEX IDX_1DAAE648AFC2B591 (module_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE licence_site (licence_id INT NOT NULL, site_id INT NOT NULL, INDEX IDX_8472C03926EF07C9 (licence_id), INDEX IDX_8472C039F6BD1646 (site_id), PRIMARY KEY(licence_id, site_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE licence ADD CONSTRAINT FK_1DAAE648AFC2B591 FOREIGN KEY (module_id) REFERENCES module (id)');
$this->addSql('ALTER TABLE licence_site ADD CONSTRAINT FK_8472C03926EF07C9 FOREIGN KEY (licence_id) REFERENCES licence (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE licence_site ADD CONSTRAINT FK_8472C039F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE licence DROP FOREIGN KEY FK_1DAAE648AFC2B591');
$this->addSql('ALTER TABLE licence_site DROP FOREIGN KEY FK_8472C03926EF07C9');
$this->addSql('ALTER TABLE licence_site DROP FOREIGN KEY FK_8472C039F6BD1646');
$this->addSql('DROP TABLE licence');
$this->addSql('DROP TABLE licence_site');
}
}