Answer the question
In order to leave comments, you need to log in
Is the database set up correctly?
For practice on php + Yii2, I want to create a website for a medical portal where you can take a ticket to the doctor.
The most difficult thing here is to properly organize the database.
Which option did I come up with?
Table of categories
Table of doctors
One-to-many relationship (1 category has several doctors)
table with days from 1 to 31
Table with appointment times
Again, one day can have several appointment times.
And a coupon table that is tied to time via a 1 to 1 connection.
The right idea? Or is there something better to fix
Answer the question
In order to leave comments, you need to log in
Table of doctors - approx.
Category table - approx.
In the real world, the relationship between them is many2many.
Further thinner.
I would make slots for recording a separate table, into which I wrote the datetime of the beginning and datetime of the end of the slot.
Slots are generated by cron for N days in advance.
The rules for generating slots - we store them in some separate tables - the exact structure depends on how flexible you want to configure it all.
Well, respectively, a separate table for coupons.
The connection between slots and many2one coupons, because coupons in reality can be canceled, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question