1 -- Create schema for monolith calendar widget.
2 -- Copyright (C) 2002 Richard W.M. Jones <rich@annexia.org>
3 -- This code is NOT REDISTRIBUTABLE. To use this widget you must purchase
4 -- a license at http://www.annexia.org/
6 -- $Id: ml_calendar_create.sql,v 1.1 2003/02/22 12:49:20 rich Exp $
8 -- Depends: monolith_core, monolith_users, monolith_auth, monolith_resources
12 create table ml_calendar
15 constraint ml_calendar_resid_pk
17 references ml_resources (resid)
21 create table ml_calendar_events
23 id serial, -- Unique event number
24 resid int4 -- Which calendar does this belong to?
25 constraint ml_calendar_events_resid_nn
27 references ml_calendar (resid)
30 -- Start and length of the event. As a special case, events
31 -- which have length == 24 hours are day events, and are shown
32 -- as notes next to each day instead of on the calendar.
33 start_time timestamp -- Start of the event
34 constraint ml_calendar_events_start_time_nn
36 length interval -- Length of the event
37 constraint ml_calendar_events_length_nn
40 -- One-off events set these to null. Recurring events set period
41 -- to period of recurrence, usually 1 day, 1 week, 1 month or 1 year.
42 -- If the last_time is set, then a recurring event ceases _after_
44 period interval, -- Recurrence period
45 last_time timestamp, -- Last recurrence of the event
47 alert interval, -- Send alert this interval before event
48 last_alert timestamp, -- Last date an alert was sent for this event
49 alert_userid int4 -- Who to send the alert to
50 references ml_users (userid)
53 subject text -- Short text description
54 constraint ml_calendar_events_title_nn
56 body text, -- Optional longer note
58 posted_date timestamp -- When entered into calendar
59 default current_timestamp
60 constraint ml_calendar_events_posted_date_nn
62 last_modified_date timestamp -- When last modified
63 default current_timestamp
64 constraint ml_calendar_last_modified_date_nn
66 author int4 -- Who last modified
67 constraint ml_calendar_events_author_nn
69 references ml_users (userid)
71 original_ip inet -- Originating IP address when posted
72 constraint ml_calendar_events_original_ip_nn
76 -- Grant access to the webservers
78 grant select on ml_calendar to nobody;
79 grant select, insert, update, delete on ml_calendar_events to nobody;
80 grant select, update on ml_calendar_events_id_seq to nobody;