[CalendarServer-changes] [5785] CalendarServer/branches/new-store/txcaldav/calendarstore
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 18 17:50:42 PDT 2010
Revision: 5785
http://trac.macosforge.org/projects/calendarserver/changeset/5785
Author: wsanchez at apple.com
Date: 2010-06-18 17:50:37 -0700 (Fri, 18 Jun 2010)
Log Message:
-----------
Move SQL into its own file.
Modified Paths:
--------------
CalendarServer/branches/new-store/txcaldav/calendarstore/postgres.py
Added Paths:
-----------
CalendarServer/branches/new-store/txcaldav/calendarstore/postgres_schema_v1.sql
Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/postgres.py 2010-06-19 00:06:36 UTC (rev 5784)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/postgres.py 2010-06-19 00:50:37 UTC (rev 5785)
@@ -20,147 +20,13 @@
"""
__all__ = [
+ "CalendarStore",
+ "CalendarHome",
+ "Calendar",
+ "CalendarObject",
]
-v1_schema = """
+from twisted.python.modules import getModule
------------------
--- Resource ID --
------------------
-create sequence RESOURCE_ID_SEQ;
-
-
------------------
-- Calendar Home -
------------------
-
-create table CALENDAR_HOME (
- RESOURCE_ID varchar(255) primary key default nextval(\xD5RESOURCE_ID_SEQ\xD5),
- OWNER_UID varchar(255) not null unique,
-);
-
-
------------------
-- Calendar Bind -
------------------
-
--- Joins CALENDAR_HOME and CALENDAR
-
-create table CALENDAR_BIND (
- CALENDAR_HOME_RESOURCE_ID varchar(255) not null, -- foreign key: CALENDAR_HOME.RESOURCE_ID
- CALENDAR_RESOURCE_ID varchar(255) not null, -- foreign key: CALENDAR.RESOURCE_ID
- CALENDAR_RESOURCE_NAME varchar(255) not null,
- CALENDAR_MODE int not null,
- SEEN_BY_OWNER bool not null,
- SEEN_BY_SHAREE bool not null,
- STATUS integer not null,
- MESSAGE text, -- FIXME: xml?
-
- primary key(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_ID),
- unique(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_NAME),
-);
-
--- Enumeration of calendar bind modes
-
-create table CALENDAR_BIND_MODE (
- ID int primary key,
- DESCRIPTION varchar(16) not null unique,
-);
-
-insert into CALENDAR_MODE values (0, "own" );
-insert into CALENDAR_MODE values (1, "read" );
-insert into CALENDAR_MODE values (2, "write");
-
--- Enumeration of statuses
-
-create table CALENDAR_BIND_STATUS (
- ID int primary key,
- DESCRIPTION varchar(16) not null unique,
-);
-
-insert into CALENDAR_BIND_STATUS values (0, "invited" );
-insert into CALENDAR_BIND_STATUS values (1, "accepted");
-insert into CALENDAR_BIND_STATUS values (2, "declined");
-
-
-------------
-- Calendar -
-------------
-
-create table CALENDAR (
- RESOURCE_ID varchar(255) primary key default nextval(\xD5RESOURCE_ID_SEQ\xD5),
- SYNC_TOKEN varchar(255),
-);
-
-
--------------------
-- Calendar Object -
--------------------
-
-create table CALENDAR_OBJECT (
- RESOURCE_ID varchar(255) primary key default nextval(\xD5RESOURCE_ID_SEQ\xD5),
- CALENDAR_RESOURCE_ID varchar(255) not null, -- foreign key: CALENDAR.RESOURCE_ID
- RESOURCE_NAME varchar(255) not null,
- ICALENDAR_TEXT text not null,
- ICALENDAR_UID varchar(255) not null,
- ICALENDAR_TYPE varchar(255) not null,
- ATTACHMENTS_MODE int not null,
- ORGANIZER varchar(255),
- ORGANIZER_OBJECT varchar(255), -- foreign key: CALENDAR_OBJECT.RESOURCE_ID
-
- unique(CALENDAR_RESOURCE_ID, RESOURCE_NAME),
- unique(CALENDAR_RESOURCE_ID, ICALENDAR_UID),
-);
-
--- Enumeration of attachment modes
-
-create table CALENDAR_OBJECT_ATTACHMENTS_MODE (
- ID int primary key,
- DESCRIPTION varchar(16) not null unique,
-);
-
-insert into CALENDAR_MODE values (0, "read" );
-insert into CALENDAR_MODE values (1, "write");
-
-
---------------
-- Attachment -
---------------
-
-create table ATTACHMENT (
- CALENDAR_OBJECT varchar(255) not null, -- foreign key: CALENDAR_OBJECT.RESOURCE_ID
- CONTENT_TYPE varchar(255) not null,
- SIZE int not null,
- MD5 char(32) not null,
- PATH varchar(255) not null unique,
-);
-
-----------------
-- iTIP Message -
-----------------
-
-create table ITIP_MESSAGE (
- CALENDAR_RESOURCE_ID varchar(255) not null, -- foreign key: CALENDAR.RESOURCE_ID
- ICALENDAR_TEXT text not null,
- ICALENDAR_UID varchar(255) not null,
- MD5 char(32) not null,
- CHANGES text not null,
-);
-
-
----------------------
-- Resource Property -
----------------------
-
-create table RESOURCE_PROPERTY (
- RESOURCE_ID varchar(255) not null, -- foreign key: *.RESOURCE_ID
- NAME varchar(255) not null,
- VALUE text not null, -- FIXME: xml?
- VIEWER_UID varchar(255),
-
- primary key(RESOURCE_ID, NAME, VIEWER_UID),
-);
-
-
-"""
+v1_schema = getModule(__name__).filePath.sibling("postgres_schema_v1.sql").getContent()
Added: CalendarServer/branches/new-store/txcaldav/calendarstore/postgres_schema_v1.sql
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/postgres_schema_v1.sql (rev 0)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/postgres_schema_v1.sql 2010-06-19 00:50:37 UTC (rev 5785)
@@ -0,0 +1,137 @@
+-----------------
+-- Resource ID --
+-----------------
+
+create sequence RESOURCE_ID_SEQ;
+
+
+-----------------
+- Calendar Home -
+-----------------
+
+create table CALENDAR_HOME (
+ RESOURCE_ID varchar(255) primary key default nextval(’RESOURCE_ID_SEQ’),
+ OWNER_UID varchar(255) not null unique,
+);
+
+
+-----------------
+- Calendar Bind -
+-----------------
+
+-- Joins CALENDAR_HOME and CALENDAR
+
+create table CALENDAR_BIND (
+ CALENDAR_HOME_RESOURCE_ID varchar(255) not null references CALENDAR_HOME,
+ CALENDAR_RESOURCE_ID varchar(255) not null references CALENDAR,
+ CALENDAR_RESOURCE_NAME varchar(255) not null,
+ CALENDAR_MODE int not null,
+ SEEN_BY_OWNER bool not null,
+ SEEN_BY_SHAREE bool not null,
+ STATUS integer not null,
+ MESSAGE text, -- FIXME: xml?
+
+ primary key(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_ID),
+ unique(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_NAME),
+);
+
+-- Enumeration of calendar bind modes
+
+create table CALENDAR_BIND_MODE (
+ ID int primary key,
+ DESCRIPTION varchar(16) not null unique,
+);
+
+insert into CALENDAR_MODE values (0, "own" );
+insert into CALENDAR_MODE values (1, "read" );
+insert into CALENDAR_MODE values (2, "write");
+
+-- Enumeration of statuses
+
+create table CALENDAR_BIND_STATUS (
+ ID int primary key,
+ DESCRIPTION varchar(16) not null unique,
+);
+
+insert into CALENDAR_BIND_STATUS values (0, "invited" );
+insert into CALENDAR_BIND_STATUS values (1, "accepted");
+insert into CALENDAR_BIND_STATUS values (2, "declined");
+
+
+------------
+- Calendar -
+------------
+
+create table CALENDAR (
+ RESOURCE_ID varchar(255) primary key default nextval(’RESOURCE_ID_SEQ’),
+ SYNC_TOKEN varchar(255),
+);
+
+
+-------------------
+- Calendar Object -
+-------------------
+
+create table CALENDAR_OBJECT (
+ RESOURCE_ID varchar(255) primary key default nextval(’RESOURCE_ID_SEQ’),
+ CALENDAR_RESOURCE_ID varchar(255) not null references CALENDAR,
+ RESOURCE_NAME varchar(255) not null,
+ ICALENDAR_TEXT text not null,
+ ICALENDAR_UID varchar(255) not null,
+ ICALENDAR_TYPE varchar(255) not null,
+ ATTACHMENTS_MODE int not null,
+ ORGANIZER varchar(255),
+ ORGANIZER_OBJECT varchar(255) references CALENDAR_OBJECT,
+
+ unique(CALENDAR_RESOURCE_ID, RESOURCE_NAME),
+ unique(CALENDAR_RESOURCE_ID, ICALENDAR_UID),
+);
+
+-- Enumeration of attachment modes
+
+create table CALENDAR_OBJECT_ATTACHMENTS_MODE (
+ ID int primary key,
+ DESCRIPTION varchar(16) not null unique,
+);
+
+insert into CALENDAR_MODE values (0, "read" );
+insert into CALENDAR_MODE values (1, "write");
+
+
+--------------
+- Attachment -
+--------------
+
+create table ATTACHMENT (
+ CALENDAR_OBJECT varchar(255) not null references CALENDAR_OBJECT,
+ CONTENT_TYPE varchar(255) not null,
+ SIZE int not null,
+ MD5 char(32) not null,
+ PATH varchar(255) not null unique,
+);
+
+----------------
+- iTIP Message -
+----------------
+
+create table ITIP_MESSAGE (
+ CALENDAR_RESOURCE_ID varchar(255) not null references CALENDAR,
+ ICALENDAR_TEXT text not null,
+ ICALENDAR_UID varchar(255) not null,
+ MD5 char(32) not null,
+ CHANGES text not null,
+);
+
+
+---------------------
+- Resource Property -
+---------------------
+
+create table RESOURCE_PROPERTY (
+ RESOURCE_ID varchar(255) not null, -- foreign key: *.RESOURCE_ID
+ NAME varchar(255) not null,
+ VALUE text not null, -- FIXME: xml?
+ VIEWER_UID varchar(255),
+
+ primary key(RESOURCE_ID, NAME, VIEWER_UID),
+);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100618/780760e7/attachment-0001.html>
More information about the calendarserver-changes
mailing list