You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
3.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 Version20250526164743 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(<<<'SQL'
CREATE TABLE task (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, produced_material_id INT NOT NULL, recipe_id INT DEFAULT NULL, parent_task_id INT DEFAULT NULL, root_task_id INT DEFAULT NULL, machine_extra_info1 VARCHAR(255) DEFAULT NULL, machine_extra_info2 VARCHAR(255) DEFAULT NULL, quantity_to_produce INT NOT NULL, quantity_provided_at_start INT NOT NULL, INDEX IDX_527EDB25A76ED395 (user_id), INDEX IDX_527EDB252B1CB36C (produced_material_id), INDEX IDX_527EDB2559D8A214 (recipe_id), INDEX IDX_527EDB25FFFE75C0 (parent_task_id), INDEX IDX_527EDB2561F7494C (root_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task ADD CONSTRAINT FK_527EDB25A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task ADD CONSTRAINT FK_527EDB252B1CB36C FOREIGN KEY (produced_material_id) REFERENCES material (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task ADD CONSTRAINT FK_527EDB2559D8A214 FOREIGN KEY (recipe_id) REFERENCES recipe (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task ADD CONSTRAINT FK_527EDB25FFFE75C0 FOREIGN KEY (parent_task_id) REFERENCES task (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task ADD CONSTRAINT FK_527EDB2561F7494C FOREIGN KEY (root_task_id) REFERENCES task (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE material_type ADD stack_name VARCHAR(50) NOT NULL
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE task DROP FOREIGN KEY FK_527EDB25A76ED395
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task DROP FOREIGN KEY FK_527EDB252B1CB36C
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task DROP FOREIGN KEY FK_527EDB2559D8A214
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task DROP FOREIGN KEY FK_527EDB25FFFE75C0
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task DROP FOREIGN KEY FK_527EDB2561F7494C
SQL);
$this->addSql(<<<'SQL'
DROP TABLE task
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE material_type DROP stack_name
SQL);
}
}