Add a patient message/communication log: a new PatientMessage entity (record-scoped, CASCADE) + repository, and owner-scoped endpoints (GET messages, POST message, DELETE message) with a validated channel (sms/note/call/email). Wire the "پیامها" tab in PatientDetailPage (send box + list + delete). PHPUnit covers create/list/delete + ownership + validation; Vitest covers the tab. API docs updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
1.3 KiB
PHP
34 lines
1.3 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 Version20260713120038 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 patient_messages (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, body LONGTEXT NOT NULL, channel VARCHAR(20) NOT NULL, created_at INT NOT NULL, record_id INT NOT NULL, UNIQUE INDEX UNIQ_EC874633D17F50A6 (uuid), INDEX idx_patient_messages_record (record_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
|
$this->addSql('ALTER TABLE patient_messages ADD CONSTRAINT FK_EC8746334DFD750C FOREIGN KEY (record_id) REFERENCES patient_records (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 patient_messages DROP FOREIGN KEY FK_EC8746334DFD750C');
|
|
$this->addSql('DROP TABLE patient_messages');
|
|
}
|
|
}
|