2
0
Эх сурвалжийг харах

updated PA module tables - added support for PIDF extensions

Vaclav Kubart 19 жил өмнө
parent
commit
b25543e8c1

+ 24 - 21
db/schema/offline_winfo.xml

@@ -12,53 +12,56 @@
     xmlns:my="http://iptel.org/dbschema/mysql"
     xmlns:pg="http://iptel.org/dbschema/postgres"
     xmlns:dt="http://iptel.org/dbschema/dbtext">
-    <name>offline_winfo</name>
-    <version>1</version>
-    
+	
+	<name>offline_winfo</name>
+	
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
+
 	<column id="offline_winfo.uid">
 		<name>uid</name>
 		<type>string</type>
 		<size>&id_len;</size>
-    </column>
-    
+	</column>
+
 	<column>
 		<name>watcher</name>
 		<type>string</type>
 		<size>&uri_len;</size>
-    </column>
-    
+	</column>
+
 	<column>
 		<name>events</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-	
+	</column>
+
 	<column>
 		<name>domain</name>
 		<type>string</type>
 		<size>&domain_len;</size>
 		<null/>
-    </column>
-	
+	</column>
+
 	<column>
 		<name>status</name>
 		<type>string</type>
 		<size>32</size>
 		<null/>
-    </column>
-	
-    <column>
+	</column>
+
+	<column>
 		<name>created_on</name>
 		<type>datetime</type>
 		<default>2006-01-31 13:13:13</default>
-    </column>
-    
+	</column>
+
 	<column>
 		<name>expires_on</name>
 		<type>datetime</type>
 		<default>2006-01-31 13:13:13</default>
-    </column>
-    
+	</column>
+
 	<column id="offline_winfo.dbid">
 		<name>dbid</name>
 		<type>unsigned int</type>
@@ -66,11 +69,11 @@
 		<my:type>INT(10) UNSIGNED AUTO_INCREMENT</my:type>
 		<pg:type>SERIAL</pg:type>
 		<dt:type>int,auto</dt:type>
-    </column>
-    
+	</column>
+
 	<index>
 		<name>offline_winfo_key</name>
 		<colref linkend="offline_winfo.dbid"/>
-    </index>
+	</index>
 
 </table>

+ 43 - 37
db/schema/presentity.xml

@@ -12,44 +12,50 @@
     xmlns:my="http://iptel.org/dbschema/mysql"
     xmlns:pg="http://iptel.org/dbschema/postgres"
     xmlns:dt="http://iptel.org/dbschema/dbtext">
-    <name>presentity</name>
-    <version>1</version>
-    
-    <column id="presentity.presid">
-	<name>presid</name>
-	<type>unsigned int</type>
-	<size>10</size>
-	<my:type>INT(10) UNSIGNED AUTO_INCREMENT</my:type>
-	<pg:type>SERIAL</pg:type>
-	<dt:type>int,auto</dt:type>
-    </column>
 	
-    <column id="presentity.uri">
-	<name>uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-    </column>
+	<name>presentity</name>
+
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
     
+	<column id="presentity.pres_id">
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
+	<column id="presentity.uri">
+		<name>uri</name>
+		<type>string</type>
+		<size>&uri_len;</size>
+	</column>
+
 	<column id="presentity.uid">
-	<name>uid</name>
-	<type>string</type>
-	<size>&id_len;</size>
-    </column>
-
-    <column>
-	<name>pdomain</name>
-	<type>string</type>
-	<size>128</size>
-    </column>
-
-    <index>
-	<name>presentity_key</name>
-	<colref linkend="presentity.presid"/>
-	<unique/>
-    </index>
-
-    <index>
-	<name>presentity_key2</name>
-	<colref linkend="presentity.uri"/>
-    </index>
+		<name>uid</name>
+		<type>string</type>
+		<size>&id_len;</size>
+	</column>
+
+	<column>
+		<name>pdomain</name>
+		<type>string</type>
+		<size>128</size>
+	</column>
+	
+	<!-- XCAP parameters has to be stored with presentity (each can
+	have other.	They are stored in serialized form (we don't need
+	to know what is within them). -->
+	<column>
+		<name>xcap_params</name>
+		<type>binary</type>
+	</column>
+
+	<!-- indexes/keys -->
+
+	<index>
+		<name>presentity_key</name>
+		<colref linkend="presentity.pres_id"/>
+		<unique/>
+	</index>
+
 </table>

+ 52 - 91
db/schema/presentity_contact.xml

@@ -12,111 +12,72 @@
     xmlns:my="http://iptel.org/dbschema/mysql"
     xmlns:pg="http://iptel.org/dbschema/postgres"
     xmlns:dt="http://iptel.org/dbschema/dbtext">
-    <name>presentity_contact</name>
-    <version>1</version>
-    
-    <column id="prescontact.contactid">
-	<name>contactid</name>
-	<type>unsigned int</type>
-	<size>10</size>
-	<my:type>INT(10) UNSIGNED AUTO_INCREMENT</my:type>
-	<pg:type>SERIAL</pg:type>
-	<dt:type>int,auto</dt:type>
-    </column>
-	
-    <column id="prescontact.presid">
-	<name>presid</name>
-	<type>unsigned int</type>
-	<size>10</size>
-    </column>
-
-    <column>
-	<name>basic</name>
-	<type>string</type>
-	<size>32</size>
-	<default>offline</default>
-    </column>
 
-    <column>
-	<name>status</name>
-	<type>string</type>
-	<size>32</size>
-    </column>
-
-    <column id="prescontact.location">
-	<name>location</name>
-	<type>string</type>
-	<size>128</size>
-    </column>
-
-    <column>
-	<name>expires</name>
-	<type>datetime</type>
-	<default>2004-05-28 21:32:15</default>
-    </column>
+	<name>presentity_contact</name>
+	
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
+    
+	<!-- presentity ID -->
+	<column id="prescontact.pres_id">
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
 
-    <column id="prescontact.placeid">
-	<name>placeid</name>
-	<type>int</type>
-	<size>10</size>
-	<null/>
-    </column>
+	<!-- basic status -->
+	<column>
+		<name>basic</name>
+		<type>int</type>
+		<size>3</size>
+	</column>
 
-    <column>
-	<name>priority</name>
-	<type>float</type>
-	<default>0.5</default>
-    </column>
+	<column>
+		<name>expires</name>
+		<type>datetime</type>
+		<default>2004-05-28 21:32:15</default>
+	</column>
 
-    <column>
-	<name>contact</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-    </column>
+	<column>
+		<name>priority</name>
+		<type>float</type>
+		<default>0.5</default>
+	</column>
 
-    <column>
-	<name>tupleid</name>
-	<type>string</type>
-	<size>64</size>
-    </column>
+	<column>
+		<name>contact</name>
+		<type>string</type>
+		<size>&uri_len;</size>
+		<null/>
+	</column>
 
-    <column>
-	<name>prescaps</name>
-	<type>int</type>
-	<size>10</size>
-    </column>
+	<!-- tuple ID -->
+	<column id="prescontact.tupleid">
+		<name>tupleid</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
 
-    <column>
+	<!-- published with this entity tag (only published tuples are stored
+	into database) -->
+	<column>
 		<name>etag</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-    
+	</column>
+
+	<!-- tuple must published with ID (see PIDF spec.) -->
 	<column>
 		<name>published_id</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-	
-    <index>
-	<name>pc_idx1</name>
-	<colref linkend="prescontact.contactid"/>
-	<unique/>
-    </index>
-
-    <index>
-	<name>presid_index</name>
-	<colref linkend="prescontact.presid"/>
-    </index>
+	</column>
 
-    <index>
-	<name>location_index</name>
-	<colref linkend="prescontact.location"/>
-    </index>
+	<index>
+		<name>presid_index</name>
+		<colref linkend="prescontact.pres_id"/>
+		<colref linkend="prescontact.tupleid"/>
+		<unique/>
+	</index>
 
-    <index>
-	<name>placeid_index</name>
-	<colref linkend="prescontact.placeid"/>
-    </index>
 </table>

+ 27 - 27
db/schema/presentity_persons.xml → db/schema/presentity_extensions.xml

@@ -12,49 +12,49 @@
     xmlns:my="http://iptel.org/dbschema/mysql"
     xmlns:pg="http://iptel.org/dbschema/postgres"
     xmlns:dt="http://iptel.org/dbschema/dbtext">
-    <name>presentity_persons</name>
-    <version>1</version>
+
+	<name>presentity_extensions</name>
+    
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
     
-    <column id="prespersons.dbid">
+	<column id="presextensions.dbid">
 		<name>dbid</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-	
+	</column>
+
 	<!-- foreign key (presentity) -->
-    <column>
-		<name>presid</name>
-		<type>unsigned int</type>
-		<size>10</size>
-    </column>
-    
+	<column>
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
+	<!-- received in PUBLISH with this entity tag -->
 	<column>
 		<name>etag</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-    
+	</column>
+
+	<!-- serialized XML element -->
 	<column>
-		<name>person_element</name>
+		<name>element</name>
 		<type>binary</type>
-    </column>
-	
-	<column>
-		<name>id</name>
-		<type>string</type>
-		<size>128</size>
-    </column>
+	</column>
 
-    <column>
+	<!-- expiration time -->
+	<column>
 		<name>expires</name>
 		<type>datetime</type>
 		<default>2005-12-07 08:13:15</default>
-    </column>
+	</column>
 
-    <index>
-		<name>prespersons_idx1</name>
-		<colref linkend="prespersons.dbid"/>
+	<index>
+		<name>presextensions_idx1</name>
+		<colref linkend="presextensions.dbid"/>
 		<unique/>
-    </index>
+	</index>
     
 </table>

+ 24 - 21
db/schema/presentity_notes.xml

@@ -12,50 +12,53 @@
     xmlns:my="http://iptel.org/dbschema/mysql"
     xmlns:pg="http://iptel.org/dbschema/postgres"
     xmlns:dt="http://iptel.org/dbschema/dbtext">
-    <name>presentity_notes</name>
-    <version>1</version>
+
+	<name>presentity_notes</name>
+    
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
     
-    <column id="presnotes.dbid">
+	<column id="presnotes.dbid">
 		<name>dbid</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-	
+	</column>
+
 	<!-- foreign key (presentity) -->
-    <column>
-		<name>presid</name>
-		<type>unsigned int</type>
-		<size>10</size>
-    </column>
-    
+	<column>
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
 	<column>
 		<name>etag</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-    
+	</column>
+
 	<column>
 		<name>note</name>
 		<type>string</type>
 		<size>128</size>
-    </column>
-	
+	</column>
+
 	<column>
 		<name>lang</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
+	</column>
 
-    <column>
+	<column>
 		<name>expires</name>
 		<type>datetime</type>
 		<default>2005-12-07 08:13:15</default>
-    </column>
+	</column>
 
-    <index>
+	<index>
 		<name>pnotes_idx1</name>
 		<colref linkend="presnotes.dbid"/>
 		<unique/>
-    </index>
-    
+	</index>
+
 </table>

+ 3 - 1
db/schema/ser.xml

@@ -41,6 +41,7 @@
 
     <!-- User location database -->
     <xi:include href="location.xml"/>
+    <xi:include href="contact_attrs.xml"/>
 
     <!-- Permissions module -->
     <xi:include href="trusted.xml"/>
@@ -69,10 +70,11 @@
     <!-- Presence related tables -->
     <xi:include href="presentity.xml"/>
     <xi:include href="presentity_notes.xml"/>
-    <xi:include href="presentity_persons.xml"/>
+    <xi:include href="presentity_extensions.xml"/>
     <xi:include href="presentity_contact.xml"/>
     <xi:include href="watcherinfo.xml"/>
     <xi:include href="tuple_notes.xml"/>
+    <xi:include href="tuple_extensions.xml"/>
     <xi:include href="offline_winfo.xml"/>
     
 	<!-- Resource-lists related tables -->

+ 47 - 0
db/schema/tuple_extensions.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE table PUBLIC "-//iptel.org//DTD DBSchema V1.0//EN"
+  "http://iptel.org/dbschema/dtd/1.0/dbschema.dtd" [
+
+<!ENTITY % entities SYSTEM "entities.xml">
+%entities;
+
+]>
+
+<table role="presence"
+    xmlns:db="http://docbook.org/ns/docbook"
+    xmlns:my="http://iptel.org/dbschema/mysql"
+    xmlns:pg="http://iptel.org/dbschema/postgres"
+    xmlns:dt="http://iptel.org/dbschema/dbtext">
+
+	<name>tuple_extensions</name>
+
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
+
+	<!-- presentity ID -->
+	<column id="tuple_notes.pres_id">
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
+	<column id="tuple_notes.tupleid">
+		<name>tupleid</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
+	<!-- serialized XML element -->
+	<column>
+		<name>element</name>
+		<type>binary</type>
+	</column>
+
+	<!-- 0 if it is not status extension, nonzero otherwise -->
+	<column>
+		<name>status_extension</name>
+		<type>int</type>
+		<size>1</size>
+	</column>
+    
+</table>

+ 19 - 17
db/schema/tuple_notes.xml

@@ -12,33 +12,35 @@
     xmlns:my="http://iptel.org/dbschema/mysql"
     xmlns:pg="http://iptel.org/dbschema/postgres"
     xmlns:dt="http://iptel.org/dbschema/dbtext">
-    <name>tuple_notes</name>
-    <version>1</version>
-    
-	<!-- foreign key (presid, tupleid -> presentity_contant) -->
-	
-    <column>
-		<name>presid</name>
-		<type>unsigned int</type>
-		<size>10</size>
-    </column>
-    
-	<column>
+
+	<name>tuple_notes</name>
+
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
+
+	<!-- presentity ID -->
+	<column id="tuple_notes.pres_id">
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
+	<column id="tuple_notes.tupleid">
 		<name>tupleid</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
-    
+	</column>
+
 	<column>
 		<name>note</name>
 		<type>string</type>
 		<size>128</size>
-    </column>
-	
+	</column>
+
 	<column>
 		<name>lang</name>
 		<type>string</type>
 		<size>64</size>
-    </column>
+	</column>
     
 </table>

+ 91 - 89
db/schema/watcherinfo.xml

@@ -9,97 +9,99 @@
 
 <table role="presence">
     <name>watcherinfo</name>
-    <version>1</version>
-    
-    <column id="watcherinfo.r_uri">
-	<name>r_uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-    </column>
-	
-    <column id="watcherinfo.w_uri">
-	<name>w_uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-    </column>
-
-    <column>
-	<name>display_name</name>
-	<type>string</type>
-	<size>128</size>
-    </column>
-
-    <column id="watcherinfo.s_id">
-	<name>s_id</name>
-	<type>string</type>
-	<size>64</size>
-    </column>
-
-    <column>
-	<name>package</name>
-	<type>string</type>
-	<size>32</size>
-	<default>presence</default>
-    </column>
-
-    <column>
-	<name>status</name>
-	<type>string</type>
-	<size>32</size>
-	<default>pending</default>
-    </column>
-
-    <column>
-	<name>event</name>
-	<type>string</type>
-	<size>32</size>
-    </column>
-
-    <column>
-	<name>expires</name>
-	<type>int</type>
-    </column>
-
-    <column>
-	<name>accepts</name>
-	<type>int</type>
-    </column>
-
-    <column>
-	<name>presid</name>
-	<type>unsigned int</type>
-	<size>10</size>
-    </column>
-
-    <column>
-	<name>server_contact</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-    </column>
-
-    <column>
-	<name>dialog</name>
-	<type>binary</type>
-    </column>
 
+	<!-- related to the version of presence snapshot -->
+	<version>5</version>
+
+	<!-- watcher's URI -->
+	<column id="watcherinfo.w_uri">
+		<name>w_uri</name>
+		<type>string</type>
+		<size>&uri_len;</size>
+	</column>
+
+	<!-- displayname information taken from From header -->
+	<column>
+		<name>display_name</name>
+		<type>string</type>
+		<size>128</size>
+	</column>
+
+	<!-- watcher's identification -->
+	<column id="watcherinfo.s_id">
+		<name>s_id</name>
+		<type>string</type>
+		<size>64</size>
+	</column>
+
+	<!-- event package: presence or presence.winfo -->
+	<column>
+		<name>package</name>
+		<type>string</type>
+		<size>32</size>
+		<default>presence</default>
+	</column>
+
+	<column>
+		<name>status</name>
+		<type>string</type>
+		<size>32</size>
+		<default>pending</default>
+	</column>
+
+	<column>
+		<name>event</name>
+		<type>string</type>
+		<size>32</size>
+	</column>
+
+	<column>
+		<name>expires</name>
+		<type>datetime</type>
+		<default>2005-12-07 08:13:15</default>
+	</column>
+
+	<column>
+		<name>accepts</name>
+		<type>int</type>
+	</column>
+
+	<!-- foreign key (presentity) -->
     <column>
-	<name>doc_index</name>
-	<type>int</type>
+		<name>pres_id</name>
+		<type>string</type>
+		<size>64</size>
     </column>
 
-    <index>
-	<name>wi_idx1</name>
-	<colref linkend="watcherinfo.s_id"/>
-	<unique/>
-    </index>
-
-    <index>
-	<name>wi_ruri_idx</name>
-	<colref linkend="watcherinfo.r_uri"/>
-    </index>
-
-    <index>
-	<name>wi_wuri_idx</name>
-	<colref linkend="watcherinfo.w_uri"/>
-    </index>
+	<column>
+		<name>server_contact</name>
+		<type>string</type>
+		<size>&uri_len;</size>
+	</column>
+
+	<column>
+		<name>dialog</name>
+		<type>binary</type>
+	</column>
+
+	<column>
+		<name>doc_index</name>
+		<type>int</type>
+	</column>
+
+	<index>
+		<name>wi_idx1</name>
+		<colref linkend="watcherinfo.s_id"/>
+		<unique/>
+	</index>
+
+	<!-- this index may help when reading from the database, 
+	but it is done only on startup thus this index is probably 
+	not needed -->
+	<!--
+	<index>
+		<name>wi_pres_idx</name>
+		<colref linkend="watcherinfo.pres_id"/>
+	</index>
+	-->
 </table>