40 lines
2.0 KiB
PHP
40 lines
2.0 KiB
PHP
![]() |
<?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 Version20250209150432 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 group_of_products (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||
|
$this->addSql('CREATE TABLE group_of_products_product (group_of_products_id INT NOT NULL, product_id INT NOT NULL, INDEX IDX_ABD75153748B7BD1 (group_of_products_id), INDEX IDX_ABD751534584665A (product_id), PRIMARY KEY(group_of_products_id, product_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||
|
$this->addSql('ALTER TABLE group_of_products_product ADD CONSTRAINT FK_ABD75153748B7BD1 FOREIGN KEY (group_of_products_id) REFERENCES group_of_products (id) ON DELETE CASCADE');
|
||
|
$this->addSql('ALTER TABLE group_of_products_product ADD CONSTRAINT FK_ABD751534584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE CASCADE');
|
||
|
$this->addSql('ALTER TABLE user ADD current_festival LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:object)\'');
|
||
|
}
|
||
|
|
||
|
public function down(Schema $schema): void
|
||
|
{
|
||
|
// this down() migration is auto-generated, please modify it to your needs
|
||
|
$this->addSql('ALTER TABLE group_of_products_product DROP FOREIGN KEY FK_ABD75153748B7BD1');
|
||
|
$this->addSql('ALTER TABLE group_of_products_product DROP FOREIGN KEY FK_ABD751534584665A');
|
||
|
$this->addSql('DROP TABLE group_of_products');
|
||
|
$this->addSql('DROP TABLE group_of_products_product');
|
||
|
$this->addSql('ALTER TABLE user DROP current_festival');
|
||
|
}
|
||
|
}
|