DataObjects/ProjectDirectory.php
[Pman.Core] / DataObjects / core.sql
index 74e293c..ea7eaa0 100644 (file)
@@ -10,7 +10,7 @@ CREATE TABLE `Companies` (
   `email` varchar(128)  default NULL,
   `id` int(11) NOT NULL auto_increment,
   `isOwner` int(11) default NULL,
-  PRIMARY KEY   (`id`),
+  PRIMARY KEY   (`id`)
   
 ) ;
 ALTER TABLE `Company_Name` ADD INDEX name_lookup (`name`);
@@ -191,7 +191,18 @@ ALTER TABLE `Projects`  ADD COLUMN `languages` varchar(128)  NOT NULL;
 ALTER TABLE  Projects ADD COLUMN agency_id int(11)  NOT NULL DEFAULT 0 ;
 
 
-
+#-- we duplicate office_id and company_id here...
+#-- not sure if we should keep doing that in the new design...
+#-- we should improve our links code to handle this..
+CREATE TABLE `ProjectDirectory` (
+  `id` int(11) NOT NULL auto_increment,
+  `project_id` int(11) NOT NULL,
+  `person_id` int(11) NOT NULL,
+  `ispm` int(11) NOT NULL,
+  `role` varchar(16) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ;
 
 CREATE TABLE   `Images` (
   `id` int(11) NOT NULL auto_increment,
@@ -253,7 +264,7 @@ CREATE TABLE  core_locking (
   `on_id` int(11)  NOT NULL,
   `person_id` int(11)  NOT NULL,
   `created` datetime  NOT NULL,
-  PRIMARY KEY (`int`),
+  PRIMARY KEY (`int`)
 );
 alter table  core_locking ADD  INDEX `lookup`(`on_table`, `on_id`, `person_id`, `created`);
 
@@ -287,13 +298,29 @@ CREATE TABLE  `translations` (
 ALTER TABLE translations ADD INDEX qlookup (module, tfile, tlang, tkey);
 
 
+# - used to trigger emails about changes to items being watched.
 
 CREATE TABLE `core_watch` (
+  `id` int(11)  NOT NULL AUTO_INCREMENT,
   `ontable` varchar(128) NOT NULL,
-  `onid` varchar(128) NOT NULL,
-  `user_id` varchar(128) NOT NULL,
+  `onid` int(11) NOT NULL,
+  `person_id` int(11) NOT NULL,
   `event` varchar(128) NOT NULL,
   `medium` varchar(128) NOT NULL,
   `active` int(11) NOT NULL DEFAULT '1',
-  PRIMARY KEY (`ontype`,`onid`,`user_id`,`event`,`medium`)
-) ;
\ No newline at end of file
+  PRIMARY KEY (id)
+) ;
+ALTER TABLE core_watch ADD INDEX qlookup (`ontable`,`onid`,`user_id`,`event`,`medium`);
+
+
+
+# - used by email / tracker to handle alises - we have to be carefull adding to this table...
+
+CREATE TABLE `core_person_alias` (
+  `id` int(11)  NOT NULL AUTO_INCREMENT,
+  `person_id` varchar(128) DEFAULT NULL,
+  `alias` varchar(254) NOT NULL,
+  PRIMARY KEY (`id`)
+) ;
+ALTER TABLE core_watch ADD INDEX qlookup (`alias`);