[CalendarServer-changes] [10123] CalendarServer/branches/users/cdaboo/managed-attachments/txdav/ common/datastore/sql_schema
source_changes at macosforge.org
source_changes at macosforge.org
Tue Dec 4 08:49:33 PST 2012
Revision: 10123
http://trac.calendarserver.org//changeset/10123
Author: cdaboo at apple.com
Date: 2012-12-04 08:49:33 -0800 (Tue, 04 Dec 2012)
Log Message:
-----------
Latest Oracle schema and upgrade.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/current-oracle-dialect.sql
CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_12_to_13.sql
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_12_to_13.sql
Modified: CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/current-oracle-dialect.sql
===================================================================
--- CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/current-oracle-dialect.sql 2012-12-04 16:48:48 UTC (rev 10122)
+++ CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/current-oracle-dialect.sql 2012-12-04 16:49:33 UTC (rev 10123)
@@ -1,5 +1,6 @@
create sequence RESOURCE_ID_SEQ;
create sequence INSTANCE_ID_SEQ;
+create sequence ATTACHMENT_ID_SEQ;
create sequence REVISION_SEQ;
create table NODE_INFO (
"HOSTNAME" nvarchar2(255),
@@ -159,6 +160,7 @@
);
create table ATTACHMENT (
+ "ATTACHMENT_ID" integer primary key,
"CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
"DROPBOX_ID" nvarchar2(255),
"CONTENT_TYPE" nvarchar2(255),
@@ -166,10 +168,17 @@
"MD5" nchar(32),
"CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
"MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
- "PATH" nvarchar2(1024),
- primary key("DROPBOX_ID", "PATH")
+ "PATH" nvarchar2(1024)
);
+create table ATTACHMENT_CALENDAR_OBJECT (
+ "ATTACHMENT_ID" integer not null references ATTACHMENT on delete cascade,
+ "MANAGED_ID" nvarchar2(255),
+ "CALENDAR_OBJECT_RESOURCE_ID" integer not null references CALENDAR_OBJECT on delete cascade,
+ primary key("ATTACHMENT_ID", "CALENDAR_OBJECT_RESOURCE_ID"),
+ unique("MANAGED_ID", "CALENDAR_OBJECT_RESOURCE_ID")
+);
+
create table RESOURCE_PROPERTY (
"RESOURCE_ID" integer not null,
"NAME" nvarchar2(255),
@@ -268,7 +277,7 @@
"VALUE" nvarchar2(255)
);
-insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '12');
+insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '13');
insert into CALENDARSERVER (NAME, VALUE) values ('CALENDAR-DATAVERSION', '3');
insert into CALENDARSERVER (NAME, VALUE) values ('ADDRESSBOOK-DATAVERSION', '1');
create index INVITE_INVITE_UID_9b0902ff on INVITE (
Added: CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_12_to_13.sql
===================================================================
--- CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_12_to_13.sql (rev 0)
+++ CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_12_to_13.sql 2012-12-04 16:49:33 UTC (rev 10123)
@@ -0,0 +1,44 @@
+----
+-- Copyright (c) 2012 Apple Inc. All rights reserved.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+----
+
+---------------------------------------------------
+-- Upgrade database schema from VERSION 12 to 13 --
+---------------------------------------------------
+
+-- Attachment related updates
+
+create sequence ATTACHMENT_ID_SEQ;
+
+
+alter table ATTACHMENT
+ drop primary key ("DROPBOX_ID", "PATH");
+alter table ATTACHMENT
+ modify (DROPBOX_ID null);
+alter table ATTACHMENT
+ add ("ATTACHMENT_ID" integer primary key);
+
+create table ATTACHMENT_CALENDAR_OBJECT (
+ "ATTACHMENT_ID" integer not null references ATTACHMENT on delete cascade,
+ "MANAGED_ID" nvarchar2(255),
+ "CALENDAR_OBJECT_RESOURCE_ID" integer not null references CALENDAR_OBJECT on delete cascade,
+ primary key ("ATTACHMENT_ID", "CALENDAR_OBJECT_RESOURCE_ID"),
+ unique ("MANAGED_ID", "CALENDAR_OBJECT_RESOURCE_ID")
+);
+
+
+-- Now update the version
+-- No data upgrades
+update CALENDARSERVER set VALUE = '13' where NAME = 'VERSION';
Modified: CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_12_to_13.sql
===================================================================
--- CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_12_to_13.sql 2012-12-04 16:48:48 UTC (rev 10122)
+++ CalendarServer/branches/users/cdaboo/managed-attachments/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_12_to_13.sql 2012-12-04 16:49:33 UTC (rev 10123)
@@ -34,8 +34,8 @@
MANAGED_ID varchar(255) not null,
CALENDAR_OBJECT_RESOURCE_ID integer not null references CALENDAR_OBJECT on delete cascade,
- primary key(ATTACHMENT_ID, CALENDAR_OBJECT_RESOURCE_ID), -- implicit index
- unique(MANAGED_ID, CALENDAR_OBJECT_RESOURCE_ID) --implicit index
+ primary key (ATTACHMENT_ID, CALENDAR_OBJECT_RESOURCE_ID), -- implicit index
+ unique (MANAGED_ID, CALENDAR_OBJECT_RESOURCE_ID) --implicit index
);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121204/a07e5c6d/attachment.html>
More information about the calendarserver-changes
mailing list