0

我有三个用于日历功能的表。说event桌子有event_id等等description

event_schedule表有event_id和。event_start_dateevent_end_date

event_repeat表有event_Schedule_idevent_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_nevergoing 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
)
4

1 回答 1

0

我认为您将不得不仅将“重复”计划用于初始计划。事情可能会重新安排,因此您不想依赖它作为权威。定期(可能每月一次?)您可能希望通过并使用该逻辑来创建新事件。要完成这项工作,您必须在日程安排表中添加“most_recent_repeat”字段或类似字段,这可以是日期或自加入。无论如何,每个事件都应该有自己的每次发生的调度条目。

如果那不能回答您的问题,则不清楚您在问什么。也许你可以澄清一下?

于 2013-11-12T01:40:19.470 回答