<?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 Version20220105145848 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 offre_paiement_type (offre_id INT NOT NULL, paiement_type_id INT NOT NULL, INDEX IDX_EB0D18314CC8505A (offre_id), INDEX IDX_EB0D1831D8763C62 (paiement_type_id), PRIMARY KEY(offre_id, paiement_type_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE paiement_type (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE offre_paiement_type ADD CONSTRAINT FK_EB0D18314CC8505A FOREIGN KEY (offre_id) REFERENCES offre (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE offre_paiement_type ADD CONSTRAINT FK_EB0D1831D8763C62 FOREIGN KEY (paiement_type_id) REFERENCES paiement_type (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 offre_paiement_type DROP FOREIGN KEY FK_EB0D1831D8763C62');
$this->addSql('DROP TABLE offre_paiement_type');
$this->addSql('DROP TABLE paiement_type');
}
}