feat : migration entry_completed + bovine.reception_id
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
35
migrations/Version20260429073108.php
Normal file
35
migrations/Version20260429073108.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260429073108 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Workflow entrée/sortie : ajout entry_completed sur reception et reception_id sur bovine.';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// Reception : flag de fermeture d'une entrée bovins.
|
||||
$this->addSql('ALTER TABLE reception ADD entry_completed BOOLEAN NOT NULL DEFAULT FALSE');
|
||||
|
||||
// Bovine : FK nullable vers la réception qui a fait entrer le bovin.
|
||||
$this->addSql('ALTER TABLE bovine ADD reception_id INT DEFAULT NULL');
|
||||
$this->addSql('CREATE INDEX IDX_BOVINE_RECEPTION ON bovine (reception_id)');
|
||||
$this->addSql('ALTER TABLE bovine ADD CONSTRAINT FK_BOVINE_RECEPTION FOREIGN KEY (reception_id) REFERENCES reception (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE bovine DROP CONSTRAINT FK_BOVINE_RECEPTION');
|
||||
$this->addSql('DROP INDEX IDX_BOVINE_RECEPTION');
|
||||
$this->addSql('ALTER TABLE bovine DROP reception_id');
|
||||
$this->addSql('ALTER TABLE reception DROP entry_completed');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user