Files
clinicpro/migrations/Version20260809092336.php
hamed a6a965a2aa feat: add admin subscription granting feature
- Implemented the ability for admins to grant subscriptions to doctors and clinics without payment.
- Added new API endpoint `/api/v1/admin/subscription/grant` for granting subscriptions.
- Updated the subscription model to track the admin who granted the subscription.
- Enhanced the subscription report to include details about granted subscriptions.
- Introduced a new `is_granted` field to indicate if a subscription was granted by an admin.
- Updated the database schema to support the new functionality with a migration.
- Added tests to ensure the correct behavior of the subscription granting process.
2026-08-09 13:43:30 +03:30

34 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Track the admin who granted a subscription without payment.
*/
final class Version20260809092336 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add granted_by_user_id to clinic_subscriptions';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE clinic_subscriptions ADD granted_by_user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE clinic_subscriptions ADD CONSTRAINT FK_E4D1CC0FF6097589 FOREIGN KEY (granted_by_user_id) REFERENCES users (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_E4D1CC0FF6097589 ON clinic_subscriptions (granted_by_user_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE clinic_subscriptions DROP FOREIGN KEY FK_E4D1CC0FF6097589');
$this->addSql('DROP INDEX IDX_E4D1CC0FF6097589 ON clinic_subscriptions');
$this->addSql('ALTER TABLE clinic_subscriptions DROP granted_by_user_id');
}
}