Kinda working with both Lightning & Evolution now. About to restructure to

add TODO items and make certain queries easier.
This commit is contained in:
Andrew McMillan committed 2006-09-21 18:24:26 +12:00
1 parent acc28c0faa
commit a57d690167
27 files changed
+2879 -2107

No files matched your search

+46 -22
View File
@@ -5,31 +5,34 @@
\i /usr/share/awl/dba/awl-tables.sql
\i /usr/share/awl/dba/schema-management.sql
CREATE TABLE ics_event_data (
-- The main event. Where we store the things the calendar throws at us.
CREATE TABLE caldav_data (
user_no INT references usr(user_no),
ics_event_name TEXT,
ics_event_etag TEXT,
ics_raw_data TEXT,
dav_name TEXT,
dav_etag TEXT,
caldav_data TEXT,
caldav_type TEXT,
logged_user INT references usr(user_no),
PRIMARY KEY ( user_no, ics_event_name, ics_event_etag )
PRIMARY KEY ( user_no, vevent_name, vevent_etag )
);
GRANT SELECT,INSERT,UPDATE,DELETE ON ics_event_data TO general;
GRANT SELECT,INSERT,UPDATE,DELETE ON vevent_data TO general;
CREATE TABLE time_zones (
tzid TEXT PRIMARY KEY,
location TEXT,
tz_spec TEXT,
pgtz TEXT
-- Not particularly needed, perhaps, except as a way to collect
-- a bunch of valid iCalendar time zone specifications... :-)
CREATE TABLE time_zone (
tz_id TEXT PRIMARY KEY,
tz_locn TEXT,
tz_spec TEXT
);
GRANT SELECT,INSERT ON time_zones TO general;
GRANT SELECT,INSERT ON time_zone TO general;
CREATE TABLE ical_events (
-- The parsed event. Here we have pulled those events apart somewhat.
CREATE TABLE event (
user_no INT references usr(user_no),
ics_event_name TEXT,
ics_event_etag TEXT,
vevent_name TEXT,
vevent_etag TEXT,
-- Extracted vEvent event data
uid TEXT,
@@ -42,12 +45,33 @@ CREATE TABLE ical_events (
transp TEXT,
description TEXT,
rrule TEXT,
tzid TEXT REFERENCES time_zones( tzid ),
tz_id TEXT REFERENCES time_zone( tz_id ),
-- Cascade updates / deletes from the ics_event_data table
CONSTRAINT ics_event_exists FOREIGN KEY ( user_no, ics_event_name, ics_event_etag )
REFERENCES ics_event_data ( user_no, ics_event_name, ics_event_etag )
-- Cascade updates / deletes from the vevent_data table
CONSTRAINT vevent_exists FOREIGN KEY ( user_no, vevent_name, vevent_etag )
REFERENCES vevent_data ( user_no, vevent_name, vevent_etag )
MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE
);
GRANT SELECT,INSERT,UPDATE,DELETE ON ical_events TO general;
GRANT SELECT,INSERT,UPDATE,DELETE ON event TO general;
-- Each user can be related to each other user. This mechanism can also
-- be used to define groups of users, since some relationships are transitive.
CREATE TABLE relationship_type (
rt_id SERIAL PRIMARY KEY,
rt_name TEXT,
rt_isgroup BOOLEAN,
rt_inverse INT,
confers TEXT DEFAULT 'RW',
prefix_match TEXT DEFAULT ''
);
GRANT SELECT,INSERT,UPDATE,DELETE ON relationship_type TO general;
CREATE TABLE relationship (
from_user INT REFERENCES usr (user_no) ON UPDATE CASCADE,
to_user INT REFERENCES usr (user_no) ON UPDATE CASCADE,
rt_id INT REFERENCES relationship_type (rt_id) ON UPDATE CASCADE
);
GRANT SELECT,INSERT,UPDATE,DELETE ON relationship TO general;