feat: Implement SMS sending functionality with KavehNegar and Rangineh providers
- Add SendSmsMessage class for encapsulating SMS message data. - Create KavehNegarProvider and RanginehProvider classes implementing SmsProviderInterface for sending SMS. - Implement SmsLogRepository and SmsTemplateRepository for managing SMS logs and templates. - Develop SendSmsHandler for handling SMS sending messages. - Create SmsService to manage SMS dispatching and logging. - Add UserProfileController for managing user profiles with CRUD operations. - Implement UserProfile entity and repository for user profile data management. - Update symfony.lock and bootstrap.php for project dependencies and environment setup.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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 Version20260609130407 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 users (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, mobile_number VARCHAR(20) NOT NULL, password_hash VARCHAR(255) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, real_name VARCHAR(100) DEFAULT NULL, roles JSON NOT NULL, status SMALLINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX UNIQ_1483A5E9D17F50A6 (uuid), UNIQUE INDEX uniq_mobile (mobile_number), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE users');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260609131304 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create categories table with seed data';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE categories (
|
||||
id INT AUTO_INCREMENT NOT NULL,
|
||||
uuid VARCHAR(36) NOT NULL,
|
||||
bundle VARCHAR(32) NOT NULL,
|
||||
label VARCHAR(255) DEFAULT NULL,
|
||||
status SMALLINT NOT NULL DEFAULT 1,
|
||||
parent_id INT DEFAULT NULL,
|
||||
weight INT NOT NULL DEFAULT 0,
|
||||
logo_id INT DEFAULT NULL,
|
||||
title VARCHAR(255) DEFAULT NULL,
|
||||
representation_id INT DEFAULT NULL,
|
||||
contact_phone VARCHAR(255) DEFAULT NULL,
|
||||
email VARCHAR(255) DEFAULT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
slogan VARCHAR(255) DEFAULT NULL,
|
||||
domain VARCHAR(255) DEFAULT NULL,
|
||||
keywords VARCHAR(255) DEFAULT NULL,
|
||||
footer_description TEXT DEFAULT NULL,
|
||||
footer_disclaimer TEXT DEFAULT NULL,
|
||||
social_media JSON DEFAULT NULL,
|
||||
UNIQUE INDEX UNIQ_3AF346686B548B0F (uuid),
|
||||
INDEX idx_categories_bundle (bundle),
|
||||
INDEX idx_categories_parent (parent_id),
|
||||
INDEX idx_categories_status (status, bundle),
|
||||
PRIMARY KEY(id)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci`');
|
||||
|
||||
// States (31 provinces)
|
||||
$states = [
|
||||
'آذربایجان شرقی', 'آذربایجان غربی', 'اردبیل', 'اصفهان', 'البرز',
|
||||
'ایلام', 'بوشهر', 'تهران', 'چهارمحال و بختیاری', 'خراسان جنوبی',
|
||||
'خراسان رضوی', 'خراسان شمالی', 'خوزستان', 'زنجان', 'سمنان',
|
||||
'سیستان و بلوچستان', 'فارس', 'قزوین', 'قم', 'کردستان',
|
||||
'کرمان', 'کرمانشاه', 'کهگیلویه و بویراحمد', 'گلستان', 'گیلان',
|
||||
'لرستان', 'مازندران', 'مرکزی', 'هرمزگان', 'همدان', 'یزد',
|
||||
];
|
||||
foreach ($states as $i => $label) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,weight) VALUES ('{$uuid}','state','{$label}',1,".($i+1).")");
|
||||
}
|
||||
|
||||
// Cities (major cities per province; parent_id = state row id 1..31)
|
||||
$cities = [
|
||||
[1,'تبریز'],[1,'مراغه'],[1,'مرند'],
|
||||
[2,'ارومیه'],[2,'خوی'],[2,'مهاباد'],
|
||||
[3,'اردبیل'],[3,'مشگینشهر'],[3,'پارسآباد'],
|
||||
[4,'اصفهان'],[4,'کاشان'],[4,'خمینیشهر'],[4,'نجفآباد'],
|
||||
[5,'کرج'],[5,'فردیس'],[5,'نظرآباد'],
|
||||
[6,'ایلام'],[6,'دهلران'],[6,'آبدانان'],
|
||||
[7,'بوشهر'],[7,'برازجان'],[7,'کنگان'],
|
||||
[8,'تهران'],[8,'ری'],[8,'شهریار'],[8,'اسلامشهر'],[8,'پردیس'],
|
||||
[9,'شهرکرد'],[9,'بروجن'],[9,'فارسان'],
|
||||
[10,'بیرجند'],[10,'قائنات'],[10,'فردوس'],
|
||||
[11,'مشهد'],[11,'نیشابور'],[11,'سبزوار'],[11,'تربتحیدریه'],
|
||||
[12,'بجنورد'],[12,'شیروان'],[12,'اسفراین'],
|
||||
[13,'اهواز'],[13,'آبادان'],[13,'خرمشهر'],[13,'دزفول'],[13,'بهبهان'],
|
||||
[14,'زنجان'],[14,'ابهر'],[14,'قیدار'],
|
||||
[15,'سمنان'],[15,'شاهرود'],[15,'دامغان'],
|
||||
[16,'زاهدان'],[16,'چابهار'],[16,'ایرانشهر'],[16,'زابل'],
|
||||
[17,'شیراز'],[17,'مرودشت'],[17,'جهرم'],[17,'فسا'],
|
||||
[18,'قزوین'],[18,'تاکستان'],[18,'البرز'],
|
||||
[19,'قم'],
|
||||
[20,'سنندج'],[20,'سقز'],[20,'مریوان'],
|
||||
[21,'کرمان'],[21,'رفسنجان'],[21,'جیرفت'],[21,'سیرجان'],
|
||||
[22,'کرمانشاه'],[22,'اسلامآباد غرب'],[22,'سرپلذهاب'],
|
||||
[23,'یاسوج'],[23,'دهدشت'],[23,'گچساران'],
|
||||
[24,'گرگان'],[24,'گنبدکاووس'],[24,'علیآباد'],
|
||||
[25,'رشت'],[25,'لاهیجان'],[25,'بندرانزلی'],[25,'رودبار'],
|
||||
[26,'خرمآباد'],[26,'بروجرد'],[26,'دورود'],
|
||||
[27,'ساری'],[27,'بابل'],[27,'آمل'],[27,'قائمشهر'],[27,'نوشهر'],
|
||||
[28,'اراک'],[28,'خمین'],[28,'ساوه'],
|
||||
[29,'بندرعباس'],[29,'قشم'],[29,'کیش'],[29,'میناب'],
|
||||
[30,'همدان'],[30,'ملایر'],[30,'نهاوند'],
|
||||
[31,'یزد'],[31,'میبد'],[31,'اردکان'],
|
||||
];
|
||||
foreach ($cities as [$stateId,$label]) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,parent_id,weight) VALUES ('{$uuid}','city','{$label}',1,{$stateId},0)");
|
||||
}
|
||||
|
||||
// Medical Specialties
|
||||
$specialties = [
|
||||
'پزشک عمومی','قلب و عروق','مغز و اعصاب','ارتوپدی','چشمپزشکی',
|
||||
'گوش و حلق و بینی','دندانپزشکی','زنان و زایمان','اطفال','پوست و مو',
|
||||
'جراحی عمومی','داخلی','روانپزشکی','اورولوژی','فیزیوتراپی','روانشناسی',
|
||||
'غدد و متابولیسم','گوارش و کبد','ریه','کلیه و مجاری ادراری',
|
||||
'جراحی مغز و اعصاب','جراحی قلب','جراحی پلاستیک','تغذیه',
|
||||
'طب سنتی','دندانپزشکی کودکان','ارتودنسی','پریودنتیکس',
|
||||
'رادیولوژی','آزمایشگاه',
|
||||
];
|
||||
foreach ($specialties as $i => $label) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,weight) VALUES ('{$uuid}','specially_doctor','{$label}',1,{$i})");
|
||||
}
|
||||
|
||||
// Doctor Services
|
||||
$services = [
|
||||
'ویزیت حضوری','ویزیت آنلاین','نوبت آنلاین','خدمات در منزل',
|
||||
'اورژانس','جراحی','آندوسکوپی','اکوکاردیوگرافی','نوار قلب (ECG)','اسپیرومتری',
|
||||
];
|
||||
foreach ($services as $i => $label) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,weight) VALUES ('{$uuid}','doctor_services','{$label}',1,{$i})");
|
||||
}
|
||||
|
||||
// Insurance Types
|
||||
$insuranceTypes = [
|
||||
'تامین اجتماعی','بیمه خدمات درمانی','بیمه ارتش',
|
||||
'آزاد (بدون بیمه)','بیمه روستایی','بیمه کارمندی دولت',
|
||||
];
|
||||
foreach ($insuranceTypes as $i => $label) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,weight) VALUES ('{$uuid}','insurance_type','{$label}',1,{$i})");
|
||||
}
|
||||
|
||||
// Supplementary Insurance
|
||||
$suppInsurances = [
|
||||
'بیمه ایران','بیمه آسیا','بیمه دی','بیمه ملت','بیمه پارسیان',
|
||||
'بیمه البرز','بیمه سینا','بیمه رازی','بیمه کوثر','بیمه نوین',
|
||||
];
|
||||
foreach ($suppInsurances as $i => $label) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,weight) VALUES ('{$uuid}','supplementary_insurance','{$label}',1,{$i})");
|
||||
}
|
||||
|
||||
// Tags
|
||||
$tags = [
|
||||
'سلامت','تغذیه','ورزش','بیماریهای قلبی','دیابت',
|
||||
'فشارخون','سرطان','زیبایی','کودکان','سالمندان',
|
||||
];
|
||||
foreach ($tags as $i => $label) {
|
||||
$uuid = $this->genUuid();
|
||||
$this->addSql("INSERT INTO categories (uuid,bundle,label,status,weight) VALUES ('{$uuid}','tag','{$label}',1,{$i})");
|
||||
}
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE categories');
|
||||
}
|
||||
|
||||
private function genUuid(): string
|
||||
{
|
||||
return sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0x0fff) | 0x4000,
|
||||
mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 Version20260609131553 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 categories CHANGE status status SMALLINT NOT NULL, CHANGE weight weight INT NOT NULL, CHANGE description description LONGTEXT DEFAULT NULL, CHANGE footer_description footer_description LONGTEXT DEFAULT NULL, CHANGE footer_disclaimer footer_disclaimer LONGTEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE categories RENAME INDEX uniq_3af346686b548b0f TO UNIQ_3AF34668D17F50A6');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE categories CHANGE status status SMALLINT DEFAULT 1 NOT NULL, CHANGE weight weight INT DEFAULT 0 NOT NULL, CHANGE description description TEXT DEFAULT NULL, CHANGE footer_description footer_description TEXT DEFAULT NULL, CHANGE footer_disclaimer footer_disclaimer TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE categories RENAME INDEX uniq_3af34668d17f50a6 TO UNIQ_3AF346686B548B0F');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 Version20260609132009 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 profiles (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, label VARCHAR(255) DEFAULT NULL, family VARCHAR(25) DEFAULT NULL, fathers_name VARCHAR(255) DEFAULT NULL, national_code VARCHAR(10) DEFAULT NULL, national_code_approved TINYINT NOT NULL, gender VARCHAR(10) DEFAULT NULL, date_of_birth INT DEFAULT NULL, blood_type VARCHAR(20) DEFAULT NULL, marital_status VARCHAR(30) DEFAULT NULL, education VARCHAR(100) DEFAULT NULL, job VARCHAR(100) DEFAULT NULL, address LONGTEXT DEFAULT NULL, home_phone VARCHAR(30) DEFAULT NULL, work_phone VARCHAR(30) DEFAULT NULL, insurance_id VARCHAR(50) DEFAULT NULL, basic_insurance_id INT DEFAULT NULL, supplementary_insurance_id INT DEFAULT NULL, other JSON DEFAULT NULL, sharing_with_user TINYINT NOT NULL, description LONGTEXT DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_8B308530D17F50A6 (uuid), INDEX idx_profiles_national_code (national_code), UNIQUE INDEX idx_profiles_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE profiles ADD CONSTRAINT FK_8B308530A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE profiles DROP FOREIGN KEY FK_8B308530A76ED395');
|
||||
$this->addSql('DROP TABLE profiles');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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 Version20260609132708 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 doctor_addresses (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) DEFAULT NULL, address LONGTEXT DEFAULT NULL, telephone VARCHAR(50) DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_A0D814FDD17F50A6 (uuid), INDEX idx_doctor_addresses_doctor (doctor_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE doctors (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, gender VARCHAR(10) DEFAULT NULL, medical_system_code VARCHAR(25) DEFAULT NULL, mobile_number VARCHAR(15) DEFAULT NULL, activity_time INT DEFAULT NULL, degree VARCHAR(30) DEFAULT NULL, info LONGTEXT DEFAULT NULL, images JSON DEFAULT NULL, doctor_rate DOUBLE PRECISION NOT NULL, doctor_rate_percentage DOUBLE PRECISION NOT NULL, active_doctor_appointment TINYINT NOT NULL, representation_id INT DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_B67687BED17F50A6 (uuid), INDEX idx_doctors_active (active_doctor_appointment), UNIQUE INDEX idx_doctors_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE doctor_specialties (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_C638E04B87F4FB17 (doctor_id), INDEX IDX_C638E04B12469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE doctor_expertise (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_ED88BE6087F4FB17 (doctor_id), INDEX IDX_ED88BE6012469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE doctor_states (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_955E47C087F4FB17 (doctor_id), INDEX IDX_955E47C012469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE doctor_cities (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_7DC181E687F4FB17 (doctor_id), INDEX IDX_7DC181E612469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE doctor_addresses ADD CONSTRAINT FK_A0D814FD87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE doctors ADD CONSTRAINT FK_B67687BEA76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
|
||||
$this->addSql('ALTER TABLE doctor_specialties ADD CONSTRAINT FK_C638E04B87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
|
||||
$this->addSql('ALTER TABLE doctor_specialties ADD CONSTRAINT FK_C638E04B12469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
$this->addSql('ALTER TABLE doctor_expertise ADD CONSTRAINT FK_ED88BE6087F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
|
||||
$this->addSql('ALTER TABLE doctor_expertise ADD CONSTRAINT FK_ED88BE6012469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
$this->addSql('ALTER TABLE doctor_states ADD CONSTRAINT FK_955E47C087F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
|
||||
$this->addSql('ALTER TABLE doctor_states ADD CONSTRAINT FK_955E47C012469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
$this->addSql('ALTER TABLE doctor_cities ADD CONSTRAINT FK_7DC181E687F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
|
||||
$this->addSql('ALTER TABLE doctor_cities ADD CONSTRAINT FK_7DC181E612469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE doctor_addresses DROP FOREIGN KEY FK_A0D814FD87F4FB17');
|
||||
$this->addSql('ALTER TABLE doctors DROP FOREIGN KEY FK_B67687BEA76ED395');
|
||||
$this->addSql('ALTER TABLE doctor_specialties DROP FOREIGN KEY FK_C638E04B87F4FB17');
|
||||
$this->addSql('ALTER TABLE doctor_specialties DROP FOREIGN KEY FK_C638E04B12469DE2');
|
||||
$this->addSql('ALTER TABLE doctor_expertise DROP FOREIGN KEY FK_ED88BE6087F4FB17');
|
||||
$this->addSql('ALTER TABLE doctor_expertise DROP FOREIGN KEY FK_ED88BE6012469DE2');
|
||||
$this->addSql('ALTER TABLE doctor_states DROP FOREIGN KEY FK_955E47C087F4FB17');
|
||||
$this->addSql('ALTER TABLE doctor_states DROP FOREIGN KEY FK_955E47C012469DE2');
|
||||
$this->addSql('ALTER TABLE doctor_cities DROP FOREIGN KEY FK_7DC181E687F4FB17');
|
||||
$this->addSql('ALTER TABLE doctor_cities DROP FOREIGN KEY FK_7DC181E612469DE2');
|
||||
$this->addSql('DROP TABLE doctor_addresses');
|
||||
$this->addSql('DROP TABLE doctors');
|
||||
$this->addSql('DROP TABLE doctor_specialties');
|
||||
$this->addSql('DROP TABLE doctor_expertise');
|
||||
$this->addSql('DROP TABLE doctor_states');
|
||||
$this->addSql('DROP TABLE doctor_cities');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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 Version20260609133121 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 clinics (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) DEFAULT NULL, info LONGTEXT DEFAULT NULL, address LONGTEXT DEFAULT NULL, telephone VARCHAR(50) DEFAULT NULL, is_24_7 TINYINT NOT NULL, working_days VARCHAR(255) DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, city_id INT DEFAULT NULL, state_id INT DEFAULT NULL, representation_id INT DEFAULT NULL, images_clinic JSON DEFAULT NULL, clinic_logo JSON DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_D7053B66D17F50A6 (uuid), INDEX idx_clinics_owner (user_id), INDEX idx_clinics_city (city_id), INDEX idx_clinics_state (state_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE clinic_doctors (clinic_id INT NOT NULL, doctor_id INT NOT NULL, INDEX IDX_ED177046CC22AD4 (clinic_id), INDEX IDX_ED17704687F4FB17 (doctor_id), PRIMARY KEY (clinic_id, doctor_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE clinic_specialties (clinic_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_3201DD37CC22AD4 (clinic_id), INDEX IDX_3201DD3712469DE2 (category_id), PRIMARY KEY (clinic_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE clinic_services (clinic_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_C00FFAB0CC22AD4 (clinic_id), INDEX IDX_C00FFAB012469DE2 (category_id), PRIMARY KEY (clinic_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE clinic_insurances (clinic_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_BE9FC898CC22AD4 (clinic_id), INDEX IDX_BE9FC89812469DE2 (category_id), PRIMARY KEY (clinic_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE clinics ADD CONSTRAINT FK_D7053B66A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
|
||||
$this->addSql('ALTER TABLE clinic_doctors ADD CONSTRAINT FK_ED177046CC22AD4 FOREIGN KEY (clinic_id) REFERENCES clinics (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE clinic_doctors ADD CONSTRAINT FK_ED17704687F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE clinic_specialties ADD CONSTRAINT FK_3201DD37CC22AD4 FOREIGN KEY (clinic_id) REFERENCES clinics (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE clinic_specialties ADD CONSTRAINT FK_3201DD3712469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
$this->addSql('ALTER TABLE clinic_services ADD CONSTRAINT FK_C00FFAB0CC22AD4 FOREIGN KEY (clinic_id) REFERENCES clinics (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE clinic_services ADD CONSTRAINT FK_C00FFAB012469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
$this->addSql('ALTER TABLE clinic_insurances ADD CONSTRAINT FK_BE9FC898CC22AD4 FOREIGN KEY (clinic_id) REFERENCES clinics (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE clinic_insurances ADD CONSTRAINT FK_BE9FC89812469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE clinics DROP FOREIGN KEY FK_D7053B66A76ED395');
|
||||
$this->addSql('ALTER TABLE clinic_doctors DROP FOREIGN KEY FK_ED177046CC22AD4');
|
||||
$this->addSql('ALTER TABLE clinic_doctors DROP FOREIGN KEY FK_ED17704687F4FB17');
|
||||
$this->addSql('ALTER TABLE clinic_specialties DROP FOREIGN KEY FK_3201DD37CC22AD4');
|
||||
$this->addSql('ALTER TABLE clinic_specialties DROP FOREIGN KEY FK_3201DD3712469DE2');
|
||||
$this->addSql('ALTER TABLE clinic_services DROP FOREIGN KEY FK_C00FFAB0CC22AD4');
|
||||
$this->addSql('ALTER TABLE clinic_services DROP FOREIGN KEY FK_C00FFAB012469DE2');
|
||||
$this->addSql('ALTER TABLE clinic_insurances DROP FOREIGN KEY FK_BE9FC898CC22AD4');
|
||||
$this->addSql('ALTER TABLE clinic_insurances DROP FOREIGN KEY FK_BE9FC89812469DE2');
|
||||
$this->addSql('DROP TABLE clinics');
|
||||
$this->addSql('DROP TABLE clinic_doctors');
|
||||
$this->addSql('DROP TABLE clinic_specialties');
|
||||
$this->addSql('DROP TABLE clinic_services');
|
||||
$this->addSql('DROP TABLE clinic_insurances');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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 Version20260609133334 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 doctor_insurances (id INT AUTO_INCREMENT NOT NULL, price INT DEFAULT NULL, doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_5317E58E87F4FB17 (doctor_id), INDEX idx_doctor_insurance_cat (category_id), UNIQUE INDEX idx_doctor_insurance (doctor_id, category_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE doctor_insurances ADD CONSTRAINT FK_5317E58E87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE doctor_insurances ADD CONSTRAINT FK_5317E58E12469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE doctor_insurances DROP FOREIGN KEY FK_5317E58E87F4FB17');
|
||||
$this->addSql('ALTER TABLE doctor_insurances DROP FOREIGN KEY FK_5317E58E12469DE2');
|
||||
$this->addSql('DROP TABLE doctor_insurances');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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 Version20260609133546 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 doctor_secretaries (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, permission JSON DEFAULT NULL, active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, secretary_id INT NOT NULL, UNIQUE INDEX UNIQ_8DF480E9D17F50A6 (uuid), INDEX IDX_8DF480E987F4FB17 (doctor_id), INDEX IDX_8DF480E9A2A63DB2 (secretary_id), UNIQUE INDEX idx_doctor_secretaries_pair (doctor_id, secretary_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE doctor_secretaries ADD CONSTRAINT FK_8DF480E987F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE doctor_secretaries ADD CONSTRAINT FK_8DF480E9A2A63DB2 FOREIGN KEY (secretary_id) REFERENCES users (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE doctor_secretaries DROP FOREIGN KEY FK_8DF480E987F4FB17');
|
||||
$this->addSql('ALTER TABLE doctor_secretaries DROP FOREIGN KEY FK_8DF480E9A2A63DB2');
|
||||
$this->addSql('DROP TABLE doctor_secretaries');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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 Version20260609134112 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 date_overrides (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, date INT NOT NULL, active TINYINT NOT NULL, setting JSON DEFAULT NULL, reason VARCHAR(255) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_F49AE94ED17F50A6 (uuid), INDEX IDX_F49AE94E87F4FB17 (doctor_id), INDEX idx_date_overrides_doctor_date (doctor_id, date), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE holidays (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, start_date INT NOT NULL, end_date INT NOT NULL, active TINYINT NOT NULL, reason VARCHAR(255) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_3A66A10CD17F50A6 (uuid), INDEX IDX_3A66A10C87F4FB17 (doctor_id), INDEX idx_holidays_doctor_range (doctor_id, start_date, end_date), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE weekly_schedules (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, setting JSON NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_69C327F2D17F50A6 (uuid), UNIQUE INDEX idx_weekly_schedules_doctor (doctor_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE date_overrides ADD CONSTRAINT FK_F49AE94E87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE holidays ADD CONSTRAINT FK_3A66A10C87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE weekly_schedules ADD CONSTRAINT FK_69C327F287F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE date_overrides DROP FOREIGN KEY FK_F49AE94E87F4FB17');
|
||||
$this->addSql('ALTER TABLE holidays DROP FOREIGN KEY FK_3A66A10C87F4FB17');
|
||||
$this->addSql('ALTER TABLE weekly_schedules DROP FOREIGN KEY FK_69C327F287F4FB17');
|
||||
$this->addSql('DROP TABLE date_overrides');
|
||||
$this->addSql('DROP TABLE holidays');
|
||||
$this->addSql('DROP TABLE weekly_schedules');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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 Version20260609134741 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 appointments (version INT DEFAULT 1 NOT NULL, id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, slot_start INT NOT NULL, slot_end INT NOT NULL, status VARCHAR(30) NOT NULL, note VARCHAR(255) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_6A41727AD17F50A6 (uuid), INDEX IDX_6A41727A87F4FB17 (doctor_id), INDEX IDX_6A41727AA76ED395 (user_id), INDEX idx_appointments_doctor_slot (doctor_id, slot_start), INDEX idx_appointments_user_status (user_id, status), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727A87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE RESTRICT');
|
||||
$this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727AA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
|
||||
}
|
||||
|
||||
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_6A41727A87F4FB17');
|
||||
$this->addSql('ALTER TABLE appointments DROP FOREIGN KEY FK_6A41727AA76ED395');
|
||||
$this->addSql('DROP TABLE appointments');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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 Version20260609135126 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 payments (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, order_id VARCHAR(64) NOT NULL, amount_rials INT NOT NULL, status VARCHAR(30) NOT NULL, gateway VARCHAR(20) NOT NULL, type VARCHAR(30) NOT NULL, gateway_token VARCHAR(255) DEFAULT NULL, reference_id VARCHAR(255) DEFAULT NULL, frontend_address VARCHAR(500) DEFAULT NULL, callback_ip VARCHAR(45) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, appointment_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_65D29B32D17F50A6 (uuid), UNIQUE INDEX UNIQ_65D29B328D9F6D38 (order_id), INDEX IDX_65D29B32E5B533F9 (appointment_id), INDEX idx_payments_order (order_id), INDEX idx_payments_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B32A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
|
||||
$this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B32E5B533F9 FOREIGN KEY (appointment_id) REFERENCES appointments (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 payments DROP FOREIGN KEY FK_65D29B32A76ED395');
|
||||
$this->addSql('ALTER TABLE payments DROP FOREIGN KEY FK_65D29B32E5B533F9');
|
||||
$this->addSql('DROP TABLE payments');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 Version20260609135514 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 representations (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, full_name VARCHAR(255) NOT NULL, mobile_number VARCHAR(20) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, commission_percent NUMERIC(5, 2) NOT NULL, bank_account JSON DEFAULT NULL, active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_C90A401D17F50A6 (uuid), UNIQUE INDEX UNIQ_C90A401A76ED395 (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE representations ADD CONSTRAINT FK_C90A401A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE representations DROP FOREIGN KEY FK_C90A401A76ED395');
|
||||
$this->addSql('DROP TABLE representations');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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 Version20260609135704 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 settlements (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, amount_rials INT NOT NULL, status VARCHAR(20) NOT NULL, bank_account JSON DEFAULT NULL, admin_note VARCHAR(500) DEFAULT NULL, reviewed_by INT DEFAULT NULL, reviewed_at INT DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_7BF3172D17F50A6 (uuid), INDEX IDX_7BF3172A76ED395 (user_id), INDEX idx_settlements_user_status (user_id, status), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE wallet_transactions (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, amount_rials INT NOT NULL, type VARCHAR(10) NOT NULL, description VARCHAR(255) DEFAULT NULL, balance_after INT NOT NULL, created_at INT NOT NULL, user_id INT NOT NULL, payment_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_A50205E2D17F50A6 (uuid), INDEX IDX_A50205E2A76ED395 (user_id), INDEX IDX_A50205E24C3A3BB (payment_id), INDEX idx_wallet_user_date (user_id, created_at), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE settlements ADD CONSTRAINT FK_7BF3172A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
|
||||
$this->addSql('ALTER TABLE wallet_transactions ADD CONSTRAINT FK_A50205E2A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
|
||||
$this->addSql('ALTER TABLE wallet_transactions ADD CONSTRAINT FK_A50205E24C3A3BB FOREIGN KEY (payment_id) REFERENCES payments (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 settlements DROP FOREIGN KEY FK_7BF3172A76ED395');
|
||||
$this->addSql('ALTER TABLE wallet_transactions DROP FOREIGN KEY FK_A50205E2A76ED395');
|
||||
$this->addSql('ALTER TABLE wallet_transactions DROP FOREIGN KEY FK_A50205E24C3A3BB');
|
||||
$this->addSql('DROP TABLE settlements');
|
||||
$this->addSql('DROP TABLE wallet_transactions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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 Version20260609135923 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 comments (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, body LONGTEXT NOT NULL, status VARCHAR(20) NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_5F9E962AD17F50A6 (uuid), INDEX IDX_5F9E962AA76ED395 (user_id), INDEX IDX_5F9E962A87F4FB17 (doctor_id), INDEX idx_comments_doctor_status (doctor_id, status), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE likes (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, created_at INT NOT NULL, user_id INT NOT NULL, comment_id INT NOT NULL, UNIQUE INDEX UNIQ_49CA4E7DD17F50A6 (uuid), INDEX IDX_49CA4E7DA76ED395 (user_id), INDEX IDX_49CA4E7DF8697D13 (comment_id), UNIQUE INDEX idx_likes_user_comment (user_id, comment_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE rates (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, score SMALLINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_44D4AB3CD17F50A6 (uuid), INDEX IDX_44D4AB3CA76ED395 (user_id), INDEX IDX_44D4AB3C87F4FB17 (doctor_id), UNIQUE INDEX idx_rates_user_doctor (user_id, doctor_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE comments ADD CONSTRAINT FK_5F9E962AA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE comments ADD CONSTRAINT FK_5F9E962A87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE likes ADD CONSTRAINT FK_49CA4E7DA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE likes ADD CONSTRAINT FK_49CA4E7DF8697D13 FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE rates ADD CONSTRAINT FK_44D4AB3CA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE rates ADD CONSTRAINT FK_44D4AB3C87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE comments DROP FOREIGN KEY FK_5F9E962AA76ED395');
|
||||
$this->addSql('ALTER TABLE comments DROP FOREIGN KEY FK_5F9E962A87F4FB17');
|
||||
$this->addSql('ALTER TABLE likes DROP FOREIGN KEY FK_49CA4E7DA76ED395');
|
||||
$this->addSql('ALTER TABLE likes DROP FOREIGN KEY FK_49CA4E7DF8697D13');
|
||||
$this->addSql('ALTER TABLE rates DROP FOREIGN KEY FK_44D4AB3CA76ED395');
|
||||
$this->addSql('ALTER TABLE rates DROP FOREIGN KEY FK_44D4AB3C87F4FB17');
|
||||
$this->addSql('DROP TABLE comments');
|
||||
$this->addSql('DROP TABLE likes');
|
||||
$this->addSql('DROP TABLE rates');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 Version20260609140223 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 sms_logs (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, mobile VARCHAR(20) NOT NULL, message LONGTEXT NOT NULL, provider VARCHAR(20) NOT NULL, success TINYINT NOT NULL, template_uuid VARCHAR(36) DEFAULT NULL, created_at INT NOT NULL, UNIQUE INDEX UNIQ_4BA25A0AD17F50A6 (uuid), INDEX idx_sms_logs_mobile (mobile, created_at), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE sms_templates (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(100) NOT NULL, body LONGTEXT NOT NULL, provider_code VARCHAR(100) DEFAULT NULL, status VARCHAR(20) NOT NULL, variables JSON NOT NULL, admin_note VARCHAR(500) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX UNIQ_1849BB39D17F50A6 (uuid), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE sms_logs');
|
||||
$this->addSql('DROP TABLE sms_templates');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 Version20260609140423 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 blogs (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL, summary VARCHAR(500) DEFAULT NULL, image_url VARCHAR(500) DEFAULT NULL, image_path VARCHAR(500) DEFAULT NULL, tags JSON NOT NULL, status VARCHAR(20) NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, author_id INT NOT NULL, UNIQUE INDEX UNIQ_F41BCA70D17F50A6 (uuid), UNIQUE INDEX UNIQ_F41BCA70989D9B62 (slug), INDEX IDX_F41BCA70F675F31B (author_id), INDEX idx_blogs_status (status, created_at), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE blogs ADD CONSTRAINT FK_F41BCA70F675F31B FOREIGN KEY (author_id) REFERENCES users (id) ON DELETE RESTRICT');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE blogs DROP FOREIGN KEY FK_F41BCA70F675F31B');
|
||||
$this->addSql('DROP TABLE blogs');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user