Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
almohanad.hafez
HIAST-Clinics
Commits
f35a959e
Unverified
Commit
f35a959e
authored
Aug 15, 2024
by
Almouhannad Hafez
Committed by
GitHub
Aug 15, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from Almouhannad/B_Configure-persistence
B configure persistence
parents
f37a8f42
9a3357d0
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
3218 additions
and
0 deletions
+3218
-0
DiseaseConfiguration.cs
.../Configurations/Medicals/Diseases/DiseaseConfiguration.cs
+15
-0
HospitalConfiguration.cs
...onfigurations/Medicals/Hospitals/HospitalConfiguration.cs
+15
-0
MedicalImageConfiguration.cs
...tions/Medicals/MedicalImages/MedicalImageConfiguration.cs
+16
-0
MedicalTestConfiguration.cs
...rations/Medicals/MedicalTests/MedicalTestConfiguration.cs
+17
-0
MedicineConfiguration.cs
...onfigurations/Medicals/Medicines/MedicineConfiguration.cs
+19
-0
MedicineFormConfiguration.cs
...gurations/Medicals/Medicines/MedicineFormConfiguration.cs
+18
-0
DoctorConfiguration.cs
...ence/Configurations/People/Doctors/DoctorConfiguration.cs
+26
-0
DoctorPhoneConfiguration.cs
...Configurations/People/Doctors/DoctorPhoneConfiguration.cs
+19
-0
DoctorStatusConfiguration.cs
...onfigurations/People/Doctors/DoctorStatusConfiguration.cs
+18
-0
EmployeeAdditionalInfoConfiguration.cs
...s/People/Employees/EmployeeAdditionalInfoConfiguration.cs
+31
-0
EmployeeConfiguration.cs
.../Configurations/People/Employees/EmployeeConfiguration.cs
+35
-0
EmployeeFamilyMemberConfiguration.cs
...ons/People/Employees/EmployeeFamilyMemberConfiguration.cs
+27
-0
FamilyRoleConfiguration.cs
...onfigurations/People/Employees/FamilyRoleConfiguration.cs
+17
-0
FamilyMemberConfiguration.cs
...rations/People/FamilyMembers/FamilyMemberConfiguration.cs
+20
-0
PatientConfiguration.cs
...ce/Configurations/People/Patients/PatientConfiguration.cs
+26
-0
PatientDiseaseConfiguration.cs
...igurations/People/Patients/PatientDiseaseConfiguration.cs
+28
-0
PatientMedicineConfiguration.cs
...gurations/People/Patients/PatientMedicineConfiguration.cs
+27
-0
GenderConfiguration.cs
...tence/Configurations/People/Shared/GenderConfiguration.cs
+18
-0
PersonalInfoConfiguration.cs
...Configurations/People/Shared/PersonalInfoConfiguration.cs
+17
-0
VisitConfiguration.cs
...d/Persistence/Configurations/Visits/VisitConfiguration.cs
+23
-0
VisitMedicalImageConfiguration.cs
...e/Configurations/Visits/VisitMedicalImageConfiguration.cs
+30
-0
VisitMedicalTestConfiguration.cs
...ce/Configurations/Visits/VisitMedicalTestConfiguration.cs
+30
-0
VisitMedicineConfiguration.cs
...tence/Configurations/Visits/VisitMedicineConfiguration.cs
+27
-0
WaitingListRecordConfiguration.cs
...figurations/WaitingList/WaitingListRecordConfiguration.cs
+27
-0
ClinicsDbContext.cs
Clinics.Backend/Persistence/Context/ClinicsDbContext.cs
+17
-0
20240815195550_Initial_Migration.Designer.cs
...e/Migrations/20240815195550_Initial_Migration.Designer.cs
+29
-0
20240815195550_Initial_Migration.cs
...ersistence/Migrations/20240815195550_Initial_Migration.cs
+22
-0
20240815195732_Add_Entities.Designer.cs
...stence/Migrations/20240815195732_Add_Entities.Designer.cs
+934
-0
20240815195732_Add_Entities.cs
...end/Persistence/Migrations/20240815195732_Add_Entities.cs
+739
-0
ClinicsDbContextModelSnapshot.cs
...d/Persistence/Migrations/ClinicsDbContextModelSnapshot.cs
+931
-0
No files found.
Clinics.Backend/Persistence/Configurations/Medicals/Diseases/DiseaseConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Medicals.Diseases
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Medicals.Diseases
;
internal
class
DiseaseConfiguration
:
IEntityTypeConfiguration
<
Disease
>
{
public
void
Configure
(
EntityTypeBuilder
<
Disease
>
builder
)
{
builder
.
ToTable
(
nameof
(
Disease
));
builder
.
Property
(
disease
=>
disease
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Medicals/Hospitals/HospitalConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Medicals.Hospitals
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Medicals.Hospitals
;
internal
class
HospitalConfiguration
:
IEntityTypeConfiguration
<
Hospital
>
{
public
void
Configure
(
EntityTypeBuilder
<
Hospital
>
builder
)
{
builder
.
ToTable
(
nameof
(
Hospital
));
builder
.
Property
(
hospital
=>
hospital
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Medicals/MedicalImages/MedicalImageConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Medicals.MedicalImages
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Medicals.MedicalImages
;
internal
class
MedicalImageConfiguration
:
IEntityTypeConfiguration
<
MedicalImage
>
{
public
void
Configure
(
EntityTypeBuilder
<
MedicalImage
>
builder
)
{
builder
.
ToTable
(
nameof
(
MedicalImage
));
builder
.
Property
(
medicalImage
=>
medicalImage
.
Description
).
HasMaxLength
(
250
);
builder
.
Property
(
medicalImage
=>
medicalImage
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Medicals/MedicalTests/MedicalTestConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Medicals.MedicalTests
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Medicals.MedicalTests
;
internal
class
MedicalTestConfiguration
:
IEntityTypeConfiguration
<
MedicalTest
>
{
public
void
Configure
(
EntityTypeBuilder
<
MedicalTest
>
builder
)
{
builder
.
ToTable
(
nameof
(
MedicalTest
));
builder
.
Property
(
medicalTest
=>
medicalTest
.
Description
).
HasMaxLength
(
250
);
builder
.
Property
(
medicalTest
=>
medicalTest
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Medicals/Medicines/MedicineConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Medicals.Medicines
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Medicals.Medicines
;
internal
class
MedicineConfiguration
:
IEntityTypeConfiguration
<
Medicine
>
{
public
void
Configure
(
EntityTypeBuilder
<
Medicine
>
builder
)
{
builder
.
ToTable
(
nameof
(
Medicine
));
builder
.
Property
(
e
=>
e
.
Dosage
).
HasColumnType
(
"numeric(9, 3)"
);
builder
.
HasOne
(
medicine
=>
medicine
.
MedicineForm
)
.
WithMany
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Medicals/Medicines/MedicineFormConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Medicals.Medicines.MedicineFormValues
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Medicals.Medicines
;
// TODO: Seed database with initial values from MedicineFormValues
internal
class
MedicineFormConfiguration
:
IEntityTypeConfiguration
<
MedicineForm
>
{
public
void
Configure
(
EntityTypeBuilder
<
MedicineForm
>
builder
)
{
builder
.
ToTable
(
nameof
(
MedicineForm
));
builder
.
Property
(
medicineForm
=>
medicineForm
.
Id
).
ValueGeneratedNever
();
builder
.
Property
(
medicineForm
=>
medicineForm
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Doctors/DoctorConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Doctors
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Doctors
;
internal
class
DoctorConfiguration
:
IEntityTypeConfiguration
<
Doctor
>
{
public
void
Configure
(
EntityTypeBuilder
<
Doctor
>
builder
)
{
builder
.
ToTable
(
nameof
(
Doctor
));
builder
.
HasOne
(
doctor
=>
doctor
.
PersonalInfo
)
.
WithOne
()
.
HasForeignKey
<
Doctor
>(
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
doctor
=>
doctor
.
Status
)
.
WithMany
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasMany
(
doctor
=>
doctor
.
Phones
)
.
WithOne
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Doctors/DoctorPhoneConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Doctors.Shared
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Doctors
;
internal
class
DoctorPhoneConfiguration
:
IEntityTypeConfiguration
<
DoctorPhone
>
{
public
void
Configure
(
EntityTypeBuilder
<
DoctorPhone
>
builder
)
{
builder
.
ToTable
(
nameof
(
DoctorPhone
));
builder
.
Property
(
doctorPhone
=>
doctorPhone
.
Name
).
HasMaxLength
(
50
);
builder
.
Property
(
doctorPhone
=>
doctorPhone
.
Phone
).
HasMaxLength
(
20
);
builder
.
HasIndex
(
doctorPhone
=>
doctorPhone
.
Phone
).
IsUnique
();
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Doctors/DoctorStatusConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Doctors
;
// TODO: Seed database with initial values from DoctorStatusValues
internal
class
DoctorStatusConfiguration
:
IEntityTypeConfiguration
<
DoctorStatus
>
{
public
void
Configure
(
EntityTypeBuilder
<
DoctorStatus
>
builder
)
{
builder
.
ToTable
(
nameof
(
DoctorStatus
));
builder
.
Property
(
doctorStatus
=>
doctorStatus
.
Id
).
ValueGeneratedNever
();
builder
.
Property
(
doctorStatus
=>
doctorStatus
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Employees/EmployeeAdditionalInfoConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Employees.Shared
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Employees
;
internal
class
EmployeeAdditionalInfoConfiguration
:
IEntityTypeConfiguration
<
EmployeeAdditionalInfo
>
{
public
void
Configure
(
EntityTypeBuilder
<
EmployeeAdditionalInfo
>
builder
)
{
builder
.
ToTable
(
nameof
(
EmployeeAdditionalInfo
));
builder
.
Property
(
employeeAdditionalInfo
=>
employeeAdditionalInfo
.
AcademicQualification
)
.
HasMaxLength
(
50
);
builder
.
Property
(
employeeAdditionalInfo
=>
employeeAdditionalInfo
.
WorkPhone
)
.
HasMaxLength
(
20
);
builder
.
Property
(
employeeAdditionalInfo
=>
employeeAdditionalInfo
.
Location
)
.
HasMaxLength
(
50
);
builder
.
Property
(
employeeAdditionalInfo
=>
employeeAdditionalInfo
.
Specialization
)
.
HasMaxLength
(
50
);
builder
.
Property
(
employeeAdditionalInfo
=>
employeeAdditionalInfo
.
JobStatus
)
.
HasMaxLength
(
50
);
builder
.
Property
(
e
=>
e
.
ImageUrl
)
.
HasMaxLength
(
150
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Employees/EmployeeConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Employees
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Employees
;
internal
class
EmployeeConfiguration
:
IEntityTypeConfiguration
<
Employee
>
{
public
void
Configure
(
EntityTypeBuilder
<
Employee
>
builder
)
{
builder
.
ToTable
(
nameof
(
Employee
));
builder
.
Property
(
employee
=>
employee
.
Id
).
ValueGeneratedOnAdd
();
builder
.
Property
(
employee
=>
employee
.
CenterStatus
).
HasMaxLength
(
50
);
builder
.
Property
(
employee
=>
employee
.
SerialNumber
).
HasMaxLength
(
20
);
builder
.
Property
(
employee
=>
employee
.
IsMarried
).
HasDefaultValue
(
false
)
.
IsRequired
();
builder
.
HasOne
(
employee
=>
employee
.
AdditionalInfo
)
.
WithOne
()
.
HasForeignKey
<
Employee
>(
"AdditionalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
employee
=>
employee
.
Patient
)
.
WithOne
()
.
HasForeignKey
<
Employee
>(
employee
=>
employee
.
Id
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasMany
(
employee
=>
employee
.
RelatedEmployees
)
.
WithMany
(
employee
=>
employee
.
RelatedTo
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Employees/EmployeeFamilyMemberConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Employees
;
internal
class
EmployeeFamilyMemberConfiguration
:
IEntityTypeConfiguration
<
EmployeeFamilyMember
>
{
public
void
Configure
(
EntityTypeBuilder
<
EmployeeFamilyMember
>
builder
)
{
builder
.
ToTable
(
nameof
(
EmployeeFamilyMember
));
builder
.
HasOne
(
employeeFamilyMember
=>
employeeFamilyMember
.
Role
)
.
WithMany
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
employeeFamilyMember
=>
employeeFamilyMember
.
FamilyMember
)
.
WithMany
()
.
HasForeignKey
(
employeeFamilyMember
=>
employeeFamilyMember
.
FamilyMemberId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
employeeFamilyMember
=>
employeeFamilyMember
.
Employee
)
.
WithMany
(
employee
=>
employee
.
FamilyMembers
)
.
HasForeignKey
(
employeeFamilyMember
=>
employeeFamilyMember
.
EmployeeId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Employees/FamilyRoleConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Employees
;
// TODO: Seed database with initial values from FamilyRoleValues
internal
class
FamilyRoleConfiguration
:
IEntityTypeConfiguration
<
FamilyRole
>
{
public
void
Configure
(
EntityTypeBuilder
<
FamilyRole
>
builder
)
{
builder
.
ToTable
(
nameof
(
FamilyRole
));
builder
.
Property
(
familyRole
=>
familyRole
.
Id
).
ValueGeneratedNever
();
builder
.
Property
(
familyRole
=>
familyRole
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/FamilyMembers/FamilyMemberConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.FamilyMembers
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.FamilyMembers
;
internal
class
FamilyMemberConfiguration
:
IEntityTypeConfiguration
<
FamilyMember
>
{
public
void
Configure
(
EntityTypeBuilder
<
FamilyMember
>
builder
)
{
builder
.
ToTable
(
nameof
(
FamilyMember
));
builder
.
Property
(
familyMember
=>
familyMember
.
Id
).
ValueGeneratedOnAdd
();
builder
.
HasOne
(
familyMember
=>
familyMember
.
Patient
)
.
WithOne
()
.
HasForeignKey
<
FamilyMember
>(
familyMember
=>
familyMember
.
Id
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Patients/PatientConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Patients
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Patients
;
internal
class
PatientConfiguration
:
IEntityTypeConfiguration
<
Patient
>
{
public
void
Configure
(
EntityTypeBuilder
<
Patient
>
builder
)
{
builder
.
ToTable
(
nameof
(
Patient
));
builder
.
HasOne
(
patient
=>
patient
.
PersonalInfo
)
.
WithOne
()
.
HasForeignKey
<
Patient
>(
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
patient
=>
patient
.
Gender
)
.
WithMany
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasMany
(
patient
=>
patient
.
Visits
)
.
WithOne
(
visit
=>
visit
.
Patient
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Patients/PatientDiseaseConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Patients.Relations.PatientDiseases
;
using
Domain.Entities.People.Patients.Relations.PatientMedicines
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Patients
;
internal
class
PatientDiseaseConfiguration
:
IEntityTypeConfiguration
<
PatientDisease
>
{
public
void
Configure
(
EntityTypeBuilder
<
PatientDisease
>
builder
)
{
builder
.
ToTable
(
nameof
(
PatientDisease
));
builder
.
HasOne
(
patientDisease
=>
patientDisease
.
Patient
)
.
WithMany
(
patient
=>
patient
.
Diseases
)
.
HasForeignKey
(
patientDisease
=>
patientDisease
.
PatientId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
patientDisease
=>
patientDisease
.
Disease
)
.
WithMany
(
medicine
=>
medicine
.
Patients
)
.
HasForeignKey
(
patientDisease
=>
patientDisease
.
DiseaseId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasIndex
(
patientDisease
=>
new
{
patientDisease
.
PatientId
,
patientDisease
.
DiseaseId
})
.
IsUnique
();
}
}
Clinics.Backend/Persistence/Configurations/People/Patients/PatientMedicineConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Patients.Relations.PatientMedicines
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Patients
;
internal
class
PatientMedicineConfiguration
:
IEntityTypeConfiguration
<
PatientMedicine
>
{
public
void
Configure
(
EntityTypeBuilder
<
PatientMedicine
>
builder
)
{
builder
.
ToTable
(
nameof
(
PatientMedicine
));
builder
.
HasOne
(
patientMedicine
=>
patientMedicine
.
Patient
)
.
WithMany
(
patient
=>
patient
.
Medicines
)
.
HasForeignKey
(
patientMedicine
=>
patientMedicine
.
PatientId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
patientMedicine
=>
patientMedicine
.
Medicine
)
.
WithMany
(
medicine
=>
medicine
.
Patients
)
.
HasForeignKey
(
patientMedicine
=>
patientMedicine
.
MedicineId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasIndex
(
patientMedicine
=>
new
{
patientMedicine
.
PatientId
,
patientMedicine
.
MedicineId
})
.
IsUnique
();
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Shared/GenderConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Shared.GenderValues
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Shared
;
// TODO: Seed database with initial values from GenderValues
internal
class
GenderConfiguration
:
IEntityTypeConfiguration
<
Gender
>
{
public
void
Configure
(
EntityTypeBuilder
<
Gender
>
builder
)
{
builder
.
ToTable
(
nameof
(
Gender
));
builder
.
Property
(
gender
=>
gender
.
Id
).
ValueGeneratedNever
();
builder
.
Property
(
gender
=>
gender
.
Name
).
HasMaxLength
(
50
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/People/Shared/PersonalInfoConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.People.Shared
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.People.Shared
;
internal
class
PersonalInfoConfiguration
:
IEntityTypeConfiguration
<
PersonalInfo
>
{
public
void
Configure
(
EntityTypeBuilder
<
PersonalInfo
>
builder
)
{
builder
.
ToTable
(
nameof
(
PersonalInfo
));
builder
.
Property
(
personalInfo
=>
personalInfo
.
FirstName
).
HasMaxLength
(
50
);
builder
.
Property
(
personalInfo
=>
personalInfo
.
LastName
).
HasMaxLength
(
50
);
builder
.
Property
(
personalInfo
=>
personalInfo
.
MiddleName
).
HasMaxLength
(
50
);
}
}
Clinics.Backend/Persistence/Configurations/Visits/VisitConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Visits
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Visits
;
internal
class
VisitConfiguration
:
IEntityTypeConfiguration
<
Visit
>
{
public
void
Configure
(
EntityTypeBuilder
<
Visit
>
builder
)
{
builder
.
ToTable
(
nameof
(
Visit
));
builder
.
Property
(
visit
=>
visit
.
Diagnosis
).
HasMaxLength
(
250
);
builder
.
HasOne
(
visit
=>
visit
.
Doctor
)
.
WithMany
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
visit
=>
visit
.
Hospital
)
.
WithMany
()
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Visits/VisitMedicalImageConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Visits.Relations.VisitMedicalImages
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Visits
;
internal
class
VisitMedicalImageConfiguration
:
IEntityTypeConfiguration
<
VisitMedicalImage
>
{
public
void
Configure
(
EntityTypeBuilder
<
VisitMedicalImage
>
builder
)
{
builder
.
ToTable
(
nameof
(
VisitMedicalImage
));
builder
.
Property
(
visitMedicalImage
=>
visitMedicalImage
.
Result
)
.
HasMaxLength
(
250
);
builder
.
HasOne
(
visitMedicalImage
=>
visitMedicalImage
.
Visit
)
.
WithMany
(
visit
=>
visit
.
MedicalImages
)
.
HasForeignKey
(
visitMedicalImage
=>
visitMedicalImage
.
VisitId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
visitMedicalImage
=>
visitMedicalImage
.
MedicalImage
)
.
WithMany
()
.
HasForeignKey
(
visitMedicalImage
=>
visitMedicalImage
.
MedicalImageId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasIndex
(
visitMedicalImage
=>
new
{
visitMedicalImage
.
VisitId
,
visitMedicalImage
.
MedicalImageId
})
.
IsUnique
();
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Visits/VisitMedicalTestConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Visits.Relations.VisitMedicalTests
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Visits
;
internal
class
VisitMedicalTestConfiguration
:
IEntityTypeConfiguration
<
VisitMedicalTest
>
{
public
void
Configure
(
EntityTypeBuilder
<
VisitMedicalTest
>
builder
)
{
builder
.
ToTable
(
nameof
(
VisitMedicalTest
));
builder
.
Property
(
visitMedicalTest
=>
visitMedicalTest
.
Result
)
.
HasMaxLength
(
250
);
builder
.
HasOne
(
visitMedicalTest
=>
visitMedicalTest
.
Visit
)
.
WithMany
(
visit
=>
visit
.
MedicalTests
)
.
HasForeignKey
(
visitMedicalTest
=>
visitMedicalTest
.
VisitId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
visitMedicalTest
=>
visitMedicalTest
.
MedicalTest
)
.
WithMany
()
.
HasForeignKey
(
visitMedicalTest
=>
visitMedicalTest
.
MedicalTestId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasIndex
(
visitMedicalTest
=>
new
{
visitMedicalTest
.
VisitId
,
visitMedicalTest
.
MedicalTestId
})
.
IsUnique
();
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/Visits/VisitMedicineConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.Visits.Relations.VisitMedicines
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Visits
;
internal
class
VisitMedicineConfiguration
:
IEntityTypeConfiguration
<
VisitMedicine
>
{
public
void
Configure
(
EntityTypeBuilder
<
VisitMedicine
>
builder
)
{
builder
.
ToTable
(
nameof
(
VisitMedicine
));
builder
.
HasOne
(
visitMedicine
=>
visitMedicine
.
Visit
)
.
WithMany
(
visitMedicine
=>
visitMedicine
.
Medicines
)
.
HasForeignKey
(
visitMedicine
=>
visitMedicine
.
VisitId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
visitMedicine
=>
visitMedicine
.
Medicine
)
.
WithMany
()
.
HasForeignKey
(
visitMedicine
=>
visitMedicine
.
MedicineId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasIndex
(
visitMedicine
=>
new
{
visitMedicine
.
VisitId
,
visitMedicine
.
MedicineId
})
.
IsUnique
();
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/WaitingList/WaitingListRecordConfiguration.cs
0 → 100644
View file @
f35a959e
using
Domain.Entities.WaitingList
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.WaitingList
;
internal
class
WaitingListRecordConfiguration
:
IEntityTypeConfiguration
<
WaitingListRecord
>
{
public
void
Configure
(
EntityTypeBuilder
<
WaitingListRecord
>
builder
)
{
builder
.
ToTable
(
nameof
(
WaitingListRecord
));
builder
.
Property
(
waitingListRecord
=>
waitingListRecord
.
IsServed
)
.
HasDefaultValue
(
false
)
.
IsRequired
();
builder
.
HasOne
(
waitingListRecord
=>
waitingListRecord
.
Patient
)
.
WithMany
()
.
HasForeignKey
(
waitingListRecord
=>
waitingListRecord
.
PatientId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
waitingListRecord
=>
waitingListRecord
.
Doctor
)
.
WithMany
()
.
HasForeignKey
(
waitingListRecord
=>
waitingListRecord
.
DoctorId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Context/ClinicsDbContext.cs
0 → 100644
View file @
f35a959e
using
Microsoft.EntityFrameworkCore
;
namespace
Persistence.Context
;
public
partial
class
ClinicsDbContext
:
DbContext
{
protected
override
void
OnConfiguring
(
DbContextOptionsBuilder
optionsBuilder
)
{
// TODO: Use options pattern
optionsBuilder
.
UseSqlServer
(
"server=.\\;database=Clinics;Trusted_Connection=True; Encrypt=False;MultipleActiveResultSets=true"
);
}
protected
override
void
OnModelCreating
(
ModelBuilder
modelBuilder
)
{
modelBuilder
.
ApplyConfigurationsFromAssembly
(
typeof
(
ClinicsDbContext
).
Assembly
);
}
}
Clinics.Backend/Persistence/Migrations/20240815195550_Initial_Migration.Designer.cs
0 → 100644
View file @
f35a959e
// <auto-generated />
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Persistence.Context
;
#
nullable
disable
namespace
Persistence.Migrations
{
[
DbContext
(
typeof
(
ClinicsDbContext
))]
[
Migration
(
"20240815195550_Initial_Migration"
)]
partial
class
Initial_Migration
{
/// <inheritdoc />
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"8.0.8"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
);
SqlServerModelBuilderExtensions
.
UseIdentityColumns
(
modelBuilder
);
#pragma warning restore 612, 618
}
}
}
Clinics.Backend/Persistence/Migrations/20240815195550_Initial_Migration.cs
0 → 100644
View file @
f35a959e
using
Microsoft.EntityFrameworkCore.Migrations
;
#
nullable
disable
namespace
Persistence.Migrations
{
/// <inheritdoc />
public
partial
class
Initial_Migration
:
Migration
{
/// <inheritdoc />
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
}
/// <inheritdoc />
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
}
}
}
Clinics.Backend/Persistence/Migrations/20240815195732_Add_Entities.Designer.cs
0 → 100644
View file @
f35a959e
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Persistence.Context
;
#
nullable
disable
namespace
Persistence.Migrations
{
[
DbContext
(
typeof
(
ClinicsDbContext
))]
[
Migration
(
"20240815195732_Add_Entities"
)]
partial
class
Add_Entities
{
/// <inheritdoc />
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"8.0.8"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
);
SqlServerModelBuilderExtensions
.
UseIdentityColumns
(
modelBuilder
);
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Disease"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Hospitals.Hospital"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Hospital"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Description"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicalImage"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.MedicalTests.MedicalTest"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Description"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicalTest"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
decimal
>(
"Dosage"
)
.
HasColumnType
(
"numeric(9, 3)"
);
b
.
Property
<
int
>(
"MedicineFormId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineFormId"
);
b
.
ToTable
(
"Medicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicineForm"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StatusId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
HasIndex
(
"StatusId"
);
b
.
ToTable
(
"Doctor"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues.DoctorStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"DoctorStatus"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.DoctorPhone"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
?>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Phone"
)
.
IsRequired
()
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"Phone"
)
.
IsUnique
();
b
.
ToTable
(
"DoctorPhone"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"AdditionalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"CenterStatus"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
bool
>(
"IsMarried"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
);
b
.
Property
<
string
>(
"SerialNumber"
)
.
IsRequired
()
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"AdditionalInfoId"
)
.
IsUnique
()
.
HasFilter
(
"[AdditionalInfoId] IS NOT NULL"
);
b
.
ToTable
(
"Employee"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.EmployeeFamilyMember"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"FamilyMemberId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"FamilyMemberId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"EmployeeFamilyMember"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues.FamilyRole"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"FamilyRole"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Shared.EmployeeAdditionalInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"AcademicQualification"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"ImageUrl"
)
.
HasMaxLength
(
150
)
.
HasColumnType
(
"nvarchar(150)"
);
b
.
Property
<
string
>(
"JobStatus"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Location"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Specialization"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
DateOnly
?>(
"StartDate"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
string
>(
"WorkPhone"
)
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"EmployeeAdditionalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"FamilyMember"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
DateOnly
>(
"DateOfBirth"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
int
>(
"GenderId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"GenderId"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
ToTable
(
"Patient"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientDiseases.PatientDisease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"DiseaseId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DiseaseId"
);
b
.
HasIndex
(
"PatientId"
,
"DiseaseId"
)
.
IsUnique
();
b
.
ToTable
(
"PatientDisease"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientMedicines.PatientMedicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicineId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Number"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineId"
);
b
.
HasIndex
(
"PatientId"
,
"MedicineId"
)
.
IsUnique
();
b
.
ToTable
(
"PatientMedicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Shared.GenderValues.Gender"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Gender"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Shared.PersonalInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"FirstName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"LastName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"MiddleName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"PersonalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicalImageId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Result"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicalImageId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicalImageId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicalImage"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalTests.VisitMedicalTest"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicalTestId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Result"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicalTestId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicalTestId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicalTest"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicines.VisitMedicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicineId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Number"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicineId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
DateOnly
>(
"Date"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
string
>(
"Diagnosis"
)
.
IsRequired
()
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"HospitalId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"HospitalId"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"Visit"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
?>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
bool
>(
"IsServed"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"WaitingListRecord"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"EmployeeEmployee"
,
b
=>
{
b
.
Property
<
int
>(
"RelatedEmployeesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RelatedToId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RelatedEmployeesId"
,
"RelatedToId"
);
b
.
HasIndex
(
"RelatedToId"
);
b
.
ToTable
(
"EmployeeEmployee"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
"MedicineForm"
)
.
WithMany
()
.
HasForeignKey
(
"MedicineFormId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicineForm"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Doctors.Doctor"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues.DoctorStatus"
,
"Status"
)
.
WithMany
()
.
HasForeignKey
(
"StatusId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"Status"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.DoctorPhone"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
null
)
.
WithMany
(
"Phones"
)
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Shared.EmployeeAdditionalInfo"
,
"AdditionalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Employees.Employee"
,
"AdditionalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Employees.Employee"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"AdditionalInfo"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.EmployeeFamilyMember"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
"Employee"
)
.
WithMany
(
"FamilyMembers"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
"FamilyMember"
)
.
WithMany
()
.
HasForeignKey
(
"FamilyMemberId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues.FamilyRole"
,
"Role"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"FamilyMember"
);
b
.
Navigation
(
"Role"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Shared.GenderValues.Gender"
,
"Gender"
)
.
WithMany
()
.
HasForeignKey
(
"GenderId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Patients.Patient"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Gender"
);
b
.
Navigation
(
"PersonalInfo"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientDiseases.PatientDisease"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Diseases.Disease"
,
"Disease"
)
.
WithMany
(
"Patients"
)
.
HasForeignKey
(
"DiseaseId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Diseases"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Disease"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientMedicines.PatientMedicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
"Medicine"
)
.
WithMany
(
"Patients"
)
.
HasForeignKey
(
"MedicineId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Medicines"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Medicine"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
"MedicalImage"
)
.
WithMany
()
.
HasForeignKey
(
"MedicalImageId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"MedicalImages"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicalImage"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalTests.VisitMedicalTest"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalTests.MedicalTest"
,
"MedicalTest"
)
.
WithMany
()
.
HasForeignKey
(
"MedicalTestId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"MedicalTests"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicalTest"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicines.VisitMedicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
"Medicine"
)
.
WithMany
()
.
HasForeignKey
(
"MedicineId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"Medicines"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Medicine"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithMany
()
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Medicals.Hospitals.Hospital"
,
"Hospital"
)
.
WithMany
()
.
HasForeignKey
(
"HospitalId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Visits"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"Hospital"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithMany
()
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
()
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"EmployeeEmployee"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RelatedEmployeesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RelatedToId"
)
.
OnDelete
(
DeleteBehavior
.
ClientCascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Navigation
(
"Patients"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
Navigation
(
"Patients"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
Navigation
(
"Phones"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
Navigation
(
"FamilyMembers"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
Navigation
(
"Diseases"
);
b
.
Navigation
(
"Medicines"
);
b
.
Navigation
(
"Visits"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Navigation
(
"MedicalImages"
);
b
.
Navigation
(
"MedicalTests"
);
b
.
Navigation
(
"Medicines"
);
});
#pragma warning restore 612, 618
}
}
}
Clinics.Backend/Persistence/Migrations/20240815195732_Add_Entities.cs
0 → 100644
View file @
f35a959e
using
System
;
using
Microsoft.EntityFrameworkCore.Migrations
;
#
nullable
disable
namespace
Persistence.Migrations
{
/// <inheritdoc />
public
partial
class
Add_Entities
:
Migration
{
/// <inheritdoc />
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
CreateTable
(
name
:
"Disease"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Disease"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"DoctorStatus"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_DoctorStatus"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"EmployeeAdditionalInfo"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
StartDate
=
table
.
Column
<
DateOnly
>(
type
:
"date"
,
nullable
:
true
),
AcademicQualification
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
true
),
WorkPhone
=
table
.
Column
<
string
>(
type
:
"nvarchar(20)"
,
maxLength
:
20
,
nullable
:
true
),
Location
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
true
),
Specialization
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
true
),
JobStatus
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
true
),
ImageUrl
=
table
.
Column
<
string
>(
type
:
"nvarchar(150)"
,
maxLength
:
150
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeAdditionalInfo"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"FamilyRole"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_FamilyRole"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"Gender"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Gender"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"Hospital"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Hospital"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"MedicalImage"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(250)"
,
maxLength
:
250
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_MedicalImage"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"MedicalTest"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
),
Description
=
table
.
Column
<
string
>(
type
:
"nvarchar(250)"
,
maxLength
:
250
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_MedicalTest"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"MedicineForm"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_MedicineForm"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"PersonalInfo"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
FirstName
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
),
MiddleName
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
),
LastName
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_PersonalInfo"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"Medicine"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
MedicineFormId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
false
),
Dosage
=
table
.
Column
<
decimal
>(
type
:
"numeric(9,3)"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Medicine"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Medicine_MedicineForm_MedicineFormId"
,
column
:
x
=>
x
.
MedicineFormId
,
principalTable
:
"MedicineForm"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"Doctor"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
PersonalInfoId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
StatusId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Doctor"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Doctor_DoctorStatus_StatusId"
,
column
:
x
=>
x
.
StatusId
,
principalTable
:
"DoctorStatus"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_Doctor_PersonalInfo_PersonalInfoId"
,
column
:
x
=>
x
.
PersonalInfoId
,
principalTable
:
"PersonalInfo"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"Patient"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
PersonalInfoId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
DateOfBirth
=
table
.
Column
<
DateOnly
>(
type
:
"date"
,
nullable
:
false
),
GenderId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Patient"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Patient_Gender_GenderId"
,
column
:
x
=>
x
.
GenderId
,
principalTable
:
"Gender"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_Patient_PersonalInfo_PersonalInfoId"
,
column
:
x
=>
x
.
PersonalInfoId
,
principalTable
:
"PersonalInfo"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"DoctorPhone"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
true
),
Phone
=
table
.
Column
<
string
>(
type
:
"nvarchar(20)"
,
maxLength
:
20
,
nullable
:
false
),
DoctorId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_DoctorPhone"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_DoctorPhone_Doctor_DoctorId"
,
column
:
x
=>
x
.
DoctorId
,
principalTable
:
"Doctor"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"Employee"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
AdditionalInfoId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
SerialNumber
=
table
.
Column
<
string
>(
type
:
"nvarchar(20)"
,
maxLength
:
20
,
nullable
:
false
),
CenterStatus
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
),
IsMarried
=
table
.
Column
<
bool
>(
type
:
"bit"
,
nullable
:
false
,
defaultValue
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Employee"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Employee_EmployeeAdditionalInfo_AdditionalInfoId"
,
column
:
x
=>
x
.
AdditionalInfoId
,
principalTable
:
"EmployeeAdditionalInfo"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_Employee_Patient_Id"
,
column
:
x
=>
x
.
Id
,
principalTable
:
"Patient"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"FamilyMember"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_FamilyMember"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_FamilyMember_Patient_Id"
,
column
:
x
=>
x
.
Id
,
principalTable
:
"Patient"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"PatientDisease"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
PatientId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
DiseaseId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_PatientDisease"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_PatientDisease_Disease_DiseaseId"
,
column
:
x
=>
x
.
DiseaseId
,
principalTable
:
"Disease"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_PatientDisease_Patient_PatientId"
,
column
:
x
=>
x
.
PatientId
,
principalTable
:
"Patient"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"PatientMedicine"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
PatientId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
MedicineId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Number
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_PatientMedicine"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_PatientMedicine_Medicine_MedicineId"
,
column
:
x
=>
x
.
MedicineId
,
principalTable
:
"Medicine"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_PatientMedicine_Patient_PatientId"
,
column
:
x
=>
x
.
PatientId
,
principalTable
:
"Patient"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"Visit"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
PatientId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
DoctorId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
HospitalId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
Date
=
table
.
Column
<
DateOnly
>(
type
:
"date"
,
nullable
:
false
),
Diagnosis
=
table
.
Column
<
string
>(
type
:
"nvarchar(250)"
,
maxLength
:
250
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Visit"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Visit_Doctor_DoctorId"
,
column
:
x
=>
x
.
DoctorId
,
principalTable
:
"Doctor"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_Visit_Hospital_HospitalId"
,
column
:
x
=>
x
.
HospitalId
,
principalTable
:
"Hospital"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_Visit_Patient_PatientId"
,
column
:
x
=>
x
.
PatientId
,
principalTable
:
"Patient"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"WaitingListRecord"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
PatientId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
DoctorId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
true
),
IsServed
=
table
.
Column
<
bool
>(
type
:
"bit"
,
nullable
:
false
,
defaultValue
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_WaitingListRecord"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_WaitingListRecord_Doctor_DoctorId"
,
column
:
x
=>
x
.
DoctorId
,
principalTable
:
"Doctor"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_WaitingListRecord_Patient_PatientId"
,
column
:
x
=>
x
.
PatientId
,
principalTable
:
"Patient"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"EmployeeEmployee"
,
columns
:
table
=>
new
{
RelatedEmployeesId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
RelatedToId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeEmployee"
,
x
=>
new
{
x
.
RelatedEmployeesId
,
x
.
RelatedToId
});
table
.
ForeignKey
(
name
:
"FK_EmployeeEmployee_Employee_RelatedEmployeesId"
,
column
:
x
=>
x
.
RelatedEmployeesId
,
principalTable
:
"Employee"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_EmployeeEmployee_Employee_RelatedToId"
,
column
:
x
=>
x
.
RelatedToId
,
principalTable
:
"Employee"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"EmployeeFamilyMember"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
EmployeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
FamilyMemberId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
RoleId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_EmployeeFamilyMember"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_EmployeeFamilyMember_Employee_EmployeeId"
,
column
:
x
=>
x
.
EmployeeId
,
principalTable
:
"Employee"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_EmployeeFamilyMember_FamilyMember_FamilyMemberId"
,
column
:
x
=>
x
.
FamilyMemberId
,
principalTable
:
"FamilyMember"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_EmployeeFamilyMember_FamilyRole_RoleId"
,
column
:
x
=>
x
.
RoleId
,
principalTable
:
"FamilyRole"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"VisitMedicalImage"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
VisitId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
MedicalImageId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Result
=
table
.
Column
<
string
>(
type
:
"nvarchar(250)"
,
maxLength
:
250
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_VisitMedicalImage"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_VisitMedicalImage_MedicalImage_MedicalImageId"
,
column
:
x
=>
x
.
MedicalImageId
,
principalTable
:
"MedicalImage"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_VisitMedicalImage_Visit_VisitId"
,
column
:
x
=>
x
.
VisitId
,
principalTable
:
"Visit"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"VisitMedicalTest"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
VisitId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
MedicalTestId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Result
=
table
.
Column
<
string
>(
type
:
"nvarchar(250)"
,
maxLength
:
250
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_VisitMedicalTest"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_VisitMedicalTest_MedicalTest_MedicalTestId"
,
column
:
x
=>
x
.
MedicalTestId
,
principalTable
:
"MedicalTest"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_VisitMedicalTest_Visit_VisitId"
,
column
:
x
=>
x
.
VisitId
,
principalTable
:
"Visit"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"VisitMedicine"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
VisitId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
MedicineId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
Number
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_VisitMedicine"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_VisitMedicine_Medicine_MedicineId"
,
column
:
x
=>
x
.
MedicineId
,
principalTable
:
"Medicine"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_VisitMedicine_Visit_VisitId"
,
column
:
x
=>
x
.
VisitId
,
principalTable
:
"Visit"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Doctor_PersonalInfoId"
,
table
:
"Doctor"
,
column
:
"PersonalInfoId"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Doctor_StatusId"
,
table
:
"Doctor"
,
column
:
"StatusId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DoctorPhone_DoctorId"
,
table
:
"DoctorPhone"
,
column
:
"DoctorId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DoctorPhone_Phone"
,
table
:
"DoctorPhone"
,
column
:
"Phone"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Employee_AdditionalInfoId"
,
table
:
"Employee"
,
column
:
"AdditionalInfoId"
,
unique
:
true
,
filter
:
"[AdditionalInfoId] IS NOT NULL"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeEmployee_RelatedToId"
,
table
:
"EmployeeEmployee"
,
column
:
"RelatedToId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeFamilyMember_EmployeeId"
,
table
:
"EmployeeFamilyMember"
,
column
:
"EmployeeId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeFamilyMember_FamilyMemberId"
,
table
:
"EmployeeFamilyMember"
,
column
:
"FamilyMemberId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_EmployeeFamilyMember_RoleId"
,
table
:
"EmployeeFamilyMember"
,
column
:
"RoleId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Medicine_MedicineFormId"
,
table
:
"Medicine"
,
column
:
"MedicineFormId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Patient_GenderId"
,
table
:
"Patient"
,
column
:
"GenderId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Patient_PersonalInfoId"
,
table
:
"Patient"
,
column
:
"PersonalInfoId"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_PatientDisease_DiseaseId"
,
table
:
"PatientDisease"
,
column
:
"DiseaseId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_PatientDisease_PatientId_DiseaseId"
,
table
:
"PatientDisease"
,
columns
:
new
[]
{
"PatientId"
,
"DiseaseId"
},
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_PatientMedicine_MedicineId"
,
table
:
"PatientMedicine"
,
column
:
"MedicineId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_PatientMedicine_PatientId_MedicineId"
,
table
:
"PatientMedicine"
,
columns
:
new
[]
{
"PatientId"
,
"MedicineId"
},
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Visit_DoctorId"
,
table
:
"Visit"
,
column
:
"DoctorId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Visit_HospitalId"
,
table
:
"Visit"
,
column
:
"HospitalId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Visit_PatientId"
,
table
:
"Visit"
,
column
:
"PatientId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_VisitMedicalImage_MedicalImageId"
,
table
:
"VisitMedicalImage"
,
column
:
"MedicalImageId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_VisitMedicalImage_VisitId_MedicalImageId"
,
table
:
"VisitMedicalImage"
,
columns
:
new
[]
{
"VisitId"
,
"MedicalImageId"
},
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_VisitMedicalTest_MedicalTestId"
,
table
:
"VisitMedicalTest"
,
column
:
"MedicalTestId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_VisitMedicalTest_VisitId_MedicalTestId"
,
table
:
"VisitMedicalTest"
,
columns
:
new
[]
{
"VisitId"
,
"MedicalTestId"
},
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_VisitMedicine_MedicineId"
,
table
:
"VisitMedicine"
,
column
:
"MedicineId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_VisitMedicine_VisitId_MedicineId"
,
table
:
"VisitMedicine"
,
columns
:
new
[]
{
"VisitId"
,
"MedicineId"
},
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_WaitingListRecord_DoctorId"
,
table
:
"WaitingListRecord"
,
column
:
"DoctorId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_WaitingListRecord_PatientId"
,
table
:
"WaitingListRecord"
,
column
:
"PatientId"
);
}
/// <inheritdoc />
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"DoctorPhone"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeEmployee"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeFamilyMember"
);
migrationBuilder
.
DropTable
(
name
:
"PatientDisease"
);
migrationBuilder
.
DropTable
(
name
:
"PatientMedicine"
);
migrationBuilder
.
DropTable
(
name
:
"VisitMedicalImage"
);
migrationBuilder
.
DropTable
(
name
:
"VisitMedicalTest"
);
migrationBuilder
.
DropTable
(
name
:
"VisitMedicine"
);
migrationBuilder
.
DropTable
(
name
:
"WaitingListRecord"
);
migrationBuilder
.
DropTable
(
name
:
"Employee"
);
migrationBuilder
.
DropTable
(
name
:
"FamilyMember"
);
migrationBuilder
.
DropTable
(
name
:
"FamilyRole"
);
migrationBuilder
.
DropTable
(
name
:
"Disease"
);
migrationBuilder
.
DropTable
(
name
:
"MedicalImage"
);
migrationBuilder
.
DropTable
(
name
:
"MedicalTest"
);
migrationBuilder
.
DropTable
(
name
:
"Medicine"
);
migrationBuilder
.
DropTable
(
name
:
"Visit"
);
migrationBuilder
.
DropTable
(
name
:
"EmployeeAdditionalInfo"
);
migrationBuilder
.
DropTable
(
name
:
"MedicineForm"
);
migrationBuilder
.
DropTable
(
name
:
"Doctor"
);
migrationBuilder
.
DropTable
(
name
:
"Hospital"
);
migrationBuilder
.
DropTable
(
name
:
"Patient"
);
migrationBuilder
.
DropTable
(
name
:
"DoctorStatus"
);
migrationBuilder
.
DropTable
(
name
:
"Gender"
);
migrationBuilder
.
DropTable
(
name
:
"PersonalInfo"
);
}
}
}
Clinics.Backend/Persistence/Migrations/ClinicsDbContextModelSnapshot.cs
0 → 100644
View file @
f35a959e
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Persistence.Context
;
#
nullable
disable
namespace
Persistence.Migrations
{
[
DbContext
(
typeof
(
ClinicsDbContext
))]
partial
class
ClinicsDbContextModelSnapshot
:
ModelSnapshot
{
protected
override
void
BuildModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"8.0.8"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
);
SqlServerModelBuilderExtensions
.
UseIdentityColumns
(
modelBuilder
);
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Disease"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Hospitals.Hospital"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Hospital"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Description"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicalImage"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.MedicalTests.MedicalTest"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Description"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicalTest"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
decimal
>(
"Dosage"
)
.
HasColumnType
(
"numeric(9, 3)"
);
b
.
Property
<
int
>(
"MedicineFormId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineFormId"
);
b
.
ToTable
(
"Medicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicineForm"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StatusId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
HasIndex
(
"StatusId"
);
b
.
ToTable
(
"Doctor"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues.DoctorStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"DoctorStatus"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.DoctorPhone"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
?>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Phone"
)
.
IsRequired
()
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"Phone"
)
.
IsUnique
();
b
.
ToTable
(
"DoctorPhone"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"AdditionalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"CenterStatus"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
bool
>(
"IsMarried"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
);
b
.
Property
<
string
>(
"SerialNumber"
)
.
IsRequired
()
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"AdditionalInfoId"
)
.
IsUnique
()
.
HasFilter
(
"[AdditionalInfoId] IS NOT NULL"
);
b
.
ToTable
(
"Employee"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.EmployeeFamilyMember"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"FamilyMemberId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"FamilyMemberId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"EmployeeFamilyMember"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues.FamilyRole"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"FamilyRole"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Shared.EmployeeAdditionalInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"AcademicQualification"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"ImageUrl"
)
.
HasMaxLength
(
150
)
.
HasColumnType
(
"nvarchar(150)"
);
b
.
Property
<
string
>(
"JobStatus"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Location"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Specialization"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
DateOnly
?>(
"StartDate"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
string
>(
"WorkPhone"
)
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"EmployeeAdditionalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"FamilyMember"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
DateOnly
>(
"DateOfBirth"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
int
>(
"GenderId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"GenderId"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
ToTable
(
"Patient"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientDiseases.PatientDisease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"DiseaseId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DiseaseId"
);
b
.
HasIndex
(
"PatientId"
,
"DiseaseId"
)
.
IsUnique
();
b
.
ToTable
(
"PatientDisease"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientMedicines.PatientMedicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicineId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Number"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineId"
);
b
.
HasIndex
(
"PatientId"
,
"MedicineId"
)
.
IsUnique
();
b
.
ToTable
(
"PatientMedicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Shared.GenderValues.Gender"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Gender"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Shared.PersonalInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"FirstName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"LastName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"MiddleName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"PersonalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicalImageId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Result"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicalImageId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicalImageId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicalImage"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalTests.VisitMedicalTest"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicalTestId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Result"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicalTestId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicalTestId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicalTest"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicines.VisitMedicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicineId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Number"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicineId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
DateOnly
>(
"Date"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
string
>(
"Diagnosis"
)
.
IsRequired
()
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"HospitalId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"HospitalId"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"Visit"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
?>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
bool
>(
"IsServed"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"WaitingListRecord"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"EmployeeEmployee"
,
b
=>
{
b
.
Property
<
int
>(
"RelatedEmployeesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RelatedToId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RelatedEmployeesId"
,
"RelatedToId"
);
b
.
HasIndex
(
"RelatedToId"
);
b
.
ToTable
(
"EmployeeEmployee"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
"MedicineForm"
)
.
WithMany
()
.
HasForeignKey
(
"MedicineFormId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicineForm"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Doctors.Doctor"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues.DoctorStatus"
,
"Status"
)
.
WithMany
()
.
HasForeignKey
(
"StatusId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"Status"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.DoctorPhone"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
null
)
.
WithMany
(
"Phones"
)
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Shared.EmployeeAdditionalInfo"
,
"AdditionalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Employees.Employee"
,
"AdditionalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Employees.Employee"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"AdditionalInfo"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.EmployeeFamilyMember"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
"Employee"
)
.
WithMany
(
"FamilyMembers"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
"FamilyMember"
)
.
WithMany
()
.
HasForeignKey
(
"FamilyMemberId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues.FamilyRole"
,
"Role"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"FamilyMember"
);
b
.
Navigation
(
"Role"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Shared.GenderValues.Gender"
,
"Gender"
)
.
WithMany
()
.
HasForeignKey
(
"GenderId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Patients.Patient"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Gender"
);
b
.
Navigation
(
"PersonalInfo"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientDiseases.PatientDisease"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Diseases.Disease"
,
"Disease"
)
.
WithMany
(
"Patients"
)
.
HasForeignKey
(
"DiseaseId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Diseases"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Disease"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientMedicines.PatientMedicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
"Medicine"
)
.
WithMany
(
"Patients"
)
.
HasForeignKey
(
"MedicineId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Medicines"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Medicine"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
"MedicalImage"
)
.
WithMany
()
.
HasForeignKey
(
"MedicalImageId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"MedicalImages"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicalImage"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalTests.VisitMedicalTest"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalTests.MedicalTest"
,
"MedicalTest"
)
.
WithMany
()
.
HasForeignKey
(
"MedicalTestId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"MedicalTests"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicalTest"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicines.VisitMedicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
"Medicine"
)
.
WithMany
()
.
HasForeignKey
(
"MedicineId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"Medicines"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Medicine"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithMany
()
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Medicals.Hospitals.Hospital"
,
"Hospital"
)
.
WithMany
()
.
HasForeignKey
(
"HospitalId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Visits"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"Hospital"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithMany
()
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
()
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"EmployeeEmployee"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RelatedEmployeesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RelatedToId"
)
.
OnDelete
(
DeleteBehavior
.
ClientCascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Navigation
(
"Patients"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
Navigation
(
"Patients"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
Navigation
(
"Phones"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
Navigation
(
"FamilyMembers"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
Navigation
(
"Diseases"
);
b
.
Navigation
(
"Medicines"
);
b
.
Navigation
(
"Visits"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Navigation
(
"MedicalImages"
);
b
.
Navigation
(
"MedicalTests"
);
b
.
Navigation
(
"Medicines"
);
});
#pragma warning restore 612, 618
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment