Files
clinicpro/migrations/Version20260614183527.php
T
hamed b0244f28f5 feat: implement staff management and subscription system
- Added StaffController for managing clinic staff, including listing, creating, updating, and toggling staff status.
- Created ClinicStaff entity and repository for staff data handling.
- Developed SubscriptionController to manage subscription plans and periods, including trial subscriptions.
- Introduced SubscriptionPlan, SubscriptionPeriod, and ClinicSubscription entities for subscription management.
- Implemented SubscriptionService for handling subscription logic, including trial activation and subscription creation from payments.
- Added necessary repositories for subscription entities to facilitate data access and manipulation.
2026-06-14 22:10:28 +03:30

48 lines
3.9 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 Version20260614183527 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_records (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, entity_type VARCHAR(10) NOT NULL, entity_id INT NOT NULL, created_by_type VARCHAR(15) NOT NULL, created_by_id INT NOT NULL, created_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_C1FE0DADD17F50A6 (uuid), INDEX IDX_C1FE0DADA76ED395 (user_id), UNIQUE INDEX uniq_patient_record (entity_type, entity_id, user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('CREATE TABLE patient_sessions (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, insurance_base_id INT DEFAULT NULL, insurance_supplementary_id INT DEFAULT NULL, visit_price_rials INT NOT NULL, base_insurance_discount_percent NUMERIC(5, 2) NOT NULL, supplementary_discount_percent NUMERIC(5, 2) NOT NULL, services_total_rials INT NOT NULL, final_price_rials INT NOT NULL, payment_method VARCHAR(15) NOT NULL, notes LONGTEXT DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, record_id INT NOT NULL, appointment_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_ADE5C5B6D17F50A6 (uuid), INDEX IDX_ADE5C5B64DFD750C (record_id), INDEX IDX_ADE5C5B6E5B533F9 (appointment_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('CREATE TABLE session_services (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, price_rials INT NOT NULL, created_at INT NOT NULL, session_id INT NOT NULL, service_item_id INT NOT NULL, staff_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_F89E8101D17F50A6 (uuid), INDEX IDX_F89E8101613FECDF (session_id), INDEX IDX_F89E8101DDEB00C2 (service_item_id), INDEX IDX_F89E8101D4D57CD (staff_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE patient_records ADD CONSTRAINT FK_C1FE0DADA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
$this->addSql('ALTER TABLE patient_sessions ADD CONSTRAINT FK_ADE5C5B64DFD750C FOREIGN KEY (record_id) REFERENCES patient_records (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE patient_sessions ADD CONSTRAINT FK_ADE5C5B6E5B533F9 FOREIGN KEY (appointment_id) REFERENCES appointments (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE session_services ADD CONSTRAINT FK_F89E8101613FECDF FOREIGN KEY (session_id) REFERENCES patient_sessions (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE session_services ADD CONSTRAINT FK_F89E8101DDEB00C2 FOREIGN KEY (service_item_id) REFERENCES service_items (id) ON DELETE RESTRICT');
$this->addSql('ALTER TABLE session_services ADD CONSTRAINT FK_F89E8101D4D57CD FOREIGN KEY (staff_id) REFERENCES clinic_staff (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE patient_records DROP FOREIGN KEY FK_C1FE0DADA76ED395');
$this->addSql('ALTER TABLE patient_sessions DROP FOREIGN KEY FK_ADE5C5B64DFD750C');
$this->addSql('ALTER TABLE patient_sessions DROP FOREIGN KEY FK_ADE5C5B6E5B533F9');
$this->addSql('ALTER TABLE session_services DROP FOREIGN KEY FK_F89E8101613FECDF');
$this->addSql('ALTER TABLE session_services DROP FOREIGN KEY FK_F89E8101DDEB00C2');
$this->addSql('ALTER TABLE session_services DROP FOREIGN KEY FK_F89E8101D4D57CD');
$this->addSql('DROP TABLE patient_records');
$this->addSql('DROP TABLE patient_sessions');
$this->addSql('DROP TABLE session_services');
}
}