Files
clinicpro/migrations/Version20260713195434.php
hamedandClaude Fable 5 4678739d15 feat(appointments): backend for clinic workflow (Figma نوبت‌ها) — phase A
Extend Appointment for the clinic-facing appointments area:

- New nullable relations service_section/service_item/staff (بخش/سرویس/پرسنل)
  plus deposit_required/deposit_amount_rials (بیعانه) and is_reserve.
- New statuses following_up (در حال پیگیری) and salon (سالن) with day-of
  transition rules; reserve entries never occupy a slot (several reserves may
  share one day), enforced in refreshActiveSlotKey.
- rescheduleTo(slotStart, slotEnd, isReserve) keeps active_slot_key consistent
  for جا به جایی and reserve transfers.
- New PATCH /api/v1/appointment/{uuid}: partial update covering edit, slot
  move (409 on taken slot, race backstop on the unique key), reserve toggle,
  patient swap (جایگزینی) and optional status transition; optimistic lock via
  version like the status endpoint.
- POST /my/appointment now accepts the workflow fields and is_reserve
  (day-level entry: no past-slot rule, no atomic slot booking); GET
  /my/appointments gains reserve=1 and returns the new fields per row.

Migration Version20260713195434 (+ mirrored on db_test). Docs updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 23:37:32 +03:30

44 lines
2.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 Version20260713195434 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 appointments ADD deposit_required TINYINT DEFAULT 0 NOT NULL, ADD deposit_amount_rials INT DEFAULT NULL, ADD is_reserve TINYINT DEFAULT 0 NOT NULL, ADD service_section_id INT DEFAULT NULL, ADD service_item_id INT DEFAULT NULL, ADD staff_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727A4E72DACE FOREIGN KEY (service_section_id) REFERENCES service_sections (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727ADDEB00C2 FOREIGN KEY (service_item_id) REFERENCES service_items (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727AD4D57CD FOREIGN KEY (staff_id) REFERENCES clinic_staff (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_6A41727A4E72DACE ON appointments (service_section_id)');
$this->addSql('CREATE INDEX IDX_6A41727ADDEB00C2 ON appointments (service_item_id)');
$this->addSql('CREATE INDEX IDX_6A41727AD4D57CD ON appointments (staff_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE appointments DROP FOREIGN KEY FK_6A41727A4E72DACE');
$this->addSql('ALTER TABLE appointments DROP FOREIGN KEY FK_6A41727ADDEB00C2');
$this->addSql('ALTER TABLE appointments DROP FOREIGN KEY FK_6A41727AD4D57CD');
$this->addSql('DROP INDEX IDX_6A41727A4E72DACE ON appointments');
$this->addSql('DROP INDEX IDX_6A41727ADDEB00C2 ON appointments');
$this->addSql('DROP INDEX IDX_6A41727AD4D57CD ON appointments');
$this->addSql('ALTER TABLE appointments DROP deposit_required, DROP deposit_amount_rials, DROP is_reserve, DROP service_section_id, DROP service_item_id, DROP staff_id');
}
}