FIxed client/trace constraint onDelete
testing/ogcore-api/pipeline/head There was a failure building this commit Details

hotfix-timeout
Manuel Aranda Rosales 2025-02-14 09:38:54 +01:00
parent 64e721cd09
commit 083aa9db7e
3 changed files with 34 additions and 3 deletions

View File

@ -0,0 +1,33 @@
<?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 Version20250214083512 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('ALTER TABLE trace DROP FOREIGN KEY FK_315BD5A119EB6921');
$this->addSql('ALTER TABLE trace ADD CONSTRAINT FK_315BD5A119EB6921 FOREIGN KEY (client_id) REFERENCES client (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 trace DROP FOREIGN KEY FK_315BD5A119EB6921');
$this->addSql('ALTER TABLE trace ADD CONSTRAINT FK_315BD5A119EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
}
}

View File

@ -15,8 +15,6 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['mac'], message: 'This MAC address is already in use.')]
class Client extends AbstractEntity
{
// TODO nueva variable bool isTeacher
use NameableTrait;
#[ORM\Column(length: 255, nullable: true)]

View File

@ -10,7 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
class Trace extends AbstractEntity
{
#[ORM\ManyToOne(inversedBy: 'traces')]
#[ORM\JoinColumn(nullable: false)]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?Client $client = null;
#[ORM\Column(length: 255, nullable: true)]