Answer the question
In order to leave comments, you need to log in
How to create a calendar table and select from it?
There is a site for renting recreation areas.
Each object has its own calendar, where you can specify the booked days.
And there is an object filter where you can specify the desired days.
In general, an analogue of Booking.
Tell me the correct structure of the calendar table so that the data is convenient to store and convenient to use in the filter.
I created my own analogue, but the table ended up being large.
My version:
CREATE TABLE `mod82_lvp_qe_calendar` (
`id` int(11) NOT NULL,
`post_id` int(11) NOT NULL,
`type` int(1) NOT NULL DEFAULT '2',
`daypart` int(1) NOT NULL DEFAULT '1',
`date` date NOT NULL,
`day_start` date NOT NULL,
`day_end` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Answer the question
In order to leave comments, you need to log in
The minimum structure of tables can be like this:
create table rest_zones (
id int primary key,
description text
);
create table bookings (
id int primary key,
rest_zone_id int,
from_date date,
to_date date,
index(rest_zone_id),
foreign key (rest_zone_id) references rest_zones(id)
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question