我有三个用于日历功能的表。说event
桌子有event_id
等等description
。
event_schedule
表有event_id
和。event_start_date
event_end_date
event_repeat
表有event_Schedule_id
和event_start_date
repeats
(可以是每周、每月、每天、每年)和 repeat_every
(1,2,3 这是间隔)
repeat_on
(mon,tue,wed,etc.sometimes blank) and
starts_on
(starting date its same date which is in event_schedule table) and (kees ends_never
going on may)
end_occurences
(no_ofoccurrence)
ends_on
是结束日期,
event_schedule_id
映射到事件日程表并且
repeated_by_month
是(如果每月这将有助于确定其月初是周末)请查找表格结构
CREATE TABLE events
(
event_id serial NOT NULL,
event_name text,
city text,
description text,
active_status text,
discount text,
user_id integer,
inserted_date timestamp without time zone,
modified_date timestamp without time zone,
state text,
CONSTRAINT event_pkey PRIMARY KEY (event_id ),
CONSTRAINT event_user_id_fkey FOREIGN KEY (user_id)
REFERENCES users (user_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)
CREATE TABLE event_schedules
(
schedule_id serial NOT NULL,
schedule_mode text,
start_date date,
end_date date,
start_time time without time zone,
end_time time without time zone,
repeat text,
activity_id integer,
business_hours text,
modified_date timestamp without time zone,
CONSTRAINT event_schedules_pkey PRIMARY KEY (schedule_id ),
CONSTRAINT event_schedules_event_id_fkey FOREIGN KEY (event_id)
REFERENCES events (event_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)
CREATE TABLE event_repeats
(
repeat_id serial NOT NULL,
repeats text,
repeat_every text,
repeat_on text,
starts_on date,
ends_never boolean,
end_occurences text,
ends_on date,
event_schedule_id integer,
modified_date timestamp without time zone,
repeated_by_month boolean,
repeat_week text,
CONSTRAINT event_repeats_pkey PRIMARY KEY (repeat_id ),
CONSTRAINT event_repeats_event_schedule_id_fkey FOREIGN KEY (event_schedule_id)
REFERENCES event_schedules (schedule_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)