diff --git a/migrations/Version20260429073108.php b/migrations/Version20260429073108.php new file mode 100644 index 0000000..946a6ed --- /dev/null +++ b/migrations/Version20260429073108.php @@ -0,0 +1,35 @@ +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'); + } +}