<?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 Version20240107203853 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 bp_category (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, label VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_5BF35382DE12AB56 (created_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE bp_category ADD CONSTRAINT FK_5BF35382DE12AB56 FOREIGN KEY (created_by) REFERENCES `user` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE bpmodel ADD bp_category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE bpmodel ADD CONSTRAINT FK_9BD00AB731D2A7B4 FOREIGN KEY (bp_category_id) REFERENCES bp_category (id)');
$this->addSql('CREATE INDEX IDX_9BD00AB731D2A7B4 ON bpmodel (bp_category_id)');
$this->addSql('ALTER TABLE payment CHANGE bp_model_id bp_model_id INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE bpmodel DROP FOREIGN KEY FK_9BD00AB731D2A7B4');
$this->addSql('ALTER TABLE bp_category DROP FOREIGN KEY FK_5BF35382DE12AB56');
$this->addSql('DROP TABLE bp_category');
$this->addSql('DROP INDEX IDX_9BD00AB731D2A7B4 ON bpmodel');
$this->addSql('ALTER TABLE bpmodel DROP bp_category_id');
$this->addSql('ALTER TABLE payment CHANGE bp_model_id bp_model_id INT NOT NULL');
}
}