Files
clinicpro/migrations/Version20260718084524.php
hamed c4a661b542 feat: add optional inventory package association to service items and implement audit logging
- Added `inventory_package_uuid` and `inventory_package_title` fields to the `ServiceItem` interface.
- Updated API documentation to reflect new fields in service item responses.
- Implemented methods in `ClinicServiceController` to handle inventory package associations.
- Created `ServiceItemAuditLog` entity and repository for tracking changes to service items.
- Added functionality to log changes to service items, including inventory package associations.
- Implemented tests for attaching/detaching inventory packages and auditing changes.
- Created database migrations for new fields and audit log table.
2026-07-18 12:26:15 +03:30

32 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* تاریخچه‌ی تغییرات خدمات — هم‌شکل session_audit_logs.
*/
final class Version20260718084524 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add service_item_audit_logs table';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE service_item_audit_logs (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, field VARCHAR(40) NOT NULL, operation VARCHAR(10) NOT NULL, old_value LONGTEXT DEFAULT NULL, new_value LONGTEXT DEFAULT NULL, actor_user_id INT DEFAULT NULL, actor_name VARCHAR(191) DEFAULT NULL, created_at INT NOT NULL, service_item_id INT NOT NULL, UNIQUE INDEX UNIQ_499F70B6D17F50A6 (uuid), INDEX IDX_499F70B6DDEB00C2 (service_item_id), INDEX idx_service_item_audit_item (service_item_id, created_at), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE service_item_audit_logs ADD CONSTRAINT FK_499F70B6DDEB00C2 FOREIGN KEY (service_item_id) REFERENCES service_items (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE service_item_audit_logs DROP FOREIGN KEY FK_499F70B6DDEB00C2');
$this->addSql('DROP TABLE service_item_audit_logs');
}
}