Files
clinicpro/migrations/Version20260614181629.php
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

46 lines
3.4 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 Version20260614181629 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 clinic_subscriptions (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, entity_type VARCHAR(10) NOT NULL, entity_id INT NOT NULL, is_trial TINYINT NOT NULL, starts_at INT NOT NULL, expires_at INT DEFAULT NULL, created_at INT NOT NULL, plan_id INT NOT NULL, period_id INT NOT NULL, payment_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_E4D1CC0FD17F50A6 (uuid), INDEX IDX_E4D1CC0FE899029B (plan_id), INDEX IDX_E4D1CC0FEC8B7ADE (period_id), INDEX IDX_E4D1CC0F4C3A3BB (payment_id), INDEX idx_subscription_entity_expires (entity_type, entity_id, expires_at), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('CREATE TABLE subscription_periods (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, label VARCHAR(50) NOT NULL, duration_months SMALLINT NOT NULL, price_rials INT NOT NULL, is_trial TINYINT NOT NULL, active TINYINT NOT NULL, sort_order SMALLINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, plan_id INT NOT NULL, UNIQUE INDEX UNIQ_14027839D17F50A6 (uuid), INDEX IDX_14027839E899029B (plan_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('CREATE TABLE subscription_plans (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(30) NOT NULL, level SMALLINT NOT NULL, max_secretaries SMALLINT NOT NULL, features JSON NOT NULL, active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX UNIQ_CF5F99A2D17F50A6 (uuid), UNIQUE INDEX UNIQ_CF5F99A25E237E06 (name), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE clinic_subscriptions ADD CONSTRAINT FK_E4D1CC0FE899029B FOREIGN KEY (plan_id) REFERENCES subscription_plans (id)');
$this->addSql('ALTER TABLE clinic_subscriptions ADD CONSTRAINT FK_E4D1CC0FEC8B7ADE FOREIGN KEY (period_id) REFERENCES subscription_periods (id)');
$this->addSql('ALTER TABLE clinic_subscriptions ADD CONSTRAINT FK_E4D1CC0F4C3A3BB FOREIGN KEY (payment_id) REFERENCES payments (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE subscription_periods ADD CONSTRAINT FK_14027839E899029B FOREIGN KEY (plan_id) REFERENCES subscription_plans (id)');
$this->addSql('ALTER TABLE payments ADD metadata JSON DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE clinic_subscriptions DROP FOREIGN KEY FK_E4D1CC0FE899029B');
$this->addSql('ALTER TABLE clinic_subscriptions DROP FOREIGN KEY FK_E4D1CC0FEC8B7ADE');
$this->addSql('ALTER TABLE clinic_subscriptions DROP FOREIGN KEY FK_E4D1CC0F4C3A3BB');
$this->addSql('ALTER TABLE subscription_periods DROP FOREIGN KEY FK_14027839E899029B');
$this->addSql('DROP TABLE clinic_subscriptions');
$this->addSql('DROP TABLE subscription_periods');
$this->addSql('DROP TABLE subscription_plans');
$this->addSql('ALTER TABLE payments DROP metadata');
}
}