added email contents for new and removed companionships
[eq/.git] / sql / tc.sql
index c42555ea1519e960c8f1296658cf14b9654b493a..7b23e0817b6b1e0d813ebf9b1664eefd402088b8 100644 (file)
@@ -14,7 +14,7 @@ USE `phpgroupware`;
 --
 -- Table structure for table `tc_activity`
 --
-CREATE TABLE `tc_activity` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_activity` (
   `activity` int(16) unsigned NOT NULL auto_increment,
   `assignment` int(16) unsigned NOT NULL,
   `date` date default NULL,
@@ -26,7 +26,7 @@ CREATE TABLE `tc_activity` (
 --
 -- Table structure for table `tc_appointment`
 --
-CREATE TABLE `tc_appointment` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_appointment` (
   `appointment` int(16) unsigned NOT NULL auto_increment,
   `presidency` int(16) unsigned NOT NULL default '0',
   `family` int(16) unsigned default '0',
@@ -41,26 +41,17 @@ CREATE TABLE `tc_appointment` (
 --
 -- Table structure for table `tc_assignment`
 --
-CREATE TABLE `tc_assignment` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_assignment` (
   `assignment` int(12) unsigned NOT NULL auto_increment,
   `name` varchar(60) NOT NULL,
   `abbreviation` varchar(12) default NULL,
   PRIMARY KEY  (`assignment`)
 ) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
 
---
--- Dumping data for table `tc_assignment`
---
-LOCK TABLES `tc_assignment` WRITE;
-/*!40000 ALTER TABLE `tc_assignment` DISABLE KEYS */;
-INSERT INTO `tc_assignment` (`assignment`, `name`, `abbreviation`) VALUES (1,'Enrichment Night Babysitting','RS'),(2,'Building Lockup','LU'),(3,'Building Cleaning Coordinator','CC'),(4,'Missionary Splits','MS'),(5,'Stake Farm','SF'),(6,'Loveland Kitchen','LK'),(7,'Moves','MV'),(8,'Temple Kitchen & Laundary','TKL'),(9,'Temple Sealings','TS'),(10,'Temple Initatories','TI');
-/*!40000 ALTER TABLE `tc_assignment` ENABLE KEYS */;
-UNLOCK TABLES;
-
 --
 -- Table structure for table `tc_attendance`
 --
-CREATE TABLE `tc_attendance` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_attendance` (
   `individual` int(16) unsigned NOT NULL default '0',
   `date` date default NULL,
   KEY `individual` (`individual`)
@@ -69,32 +60,40 @@ CREATE TABLE `tc_attendance` (
 --
 -- Table structure for table `tc_calling`
 --
-CREATE TABLE `tc_calling` (
-  `name` varchar(30) default NULL,
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_calling` (
+  `individual` int(16) unsigned default '0',
   `organization` varchar(30) default NULL,
   `position` varchar(30) default NULL,
   `sustained` varchar(30) default NULL,
+  KEY `individual` (`individual`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
 --
--- Table structure for table `tc_companionship`
+-- Table structure for table `tc_companion`
 --
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_companion` (
+  `companion` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `individual` INT( 16 ) UNSIGNED NOT NULL ,
+  `companionship` INT( 16 ) UNSIGNED NOT NULL ,
+  `scheduling_priority` INT( 16 ) UNSIGNED NOT NULL ,
+  `valid` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'
+) ENGINE = MYISAM ;
 
-CREATE TABLE `tc_companionship` (
-  `companionship` int(16) unsigned NOT NULL default '0',
-  `individual` int(16) unsigned NOT NULL default '0',
-  `district` int(16) unsigned default NULL,
-  `scheduling_priority` int(16) unsigned default NULL,
-  `valid` tinyint(1) default NULL,
-  KEY `companionship` (`companionship`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+--
+-- Table structure for table `tc_companionship`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_companionship` (
+  `companionship` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `mls_id` INT( 16 ) UNSIGNED NULL DEFAULT NULL ,
+  `district` INT( 16 ) UNSIGNED NULL DEFAULT NULL ,
+  `valid` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1'
+) ENGINE = MYISAM ;
 
 --
 -- Table structure for table `tc_district`
 --
-CREATE TABLE `tc_district` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_district` (
   `district` int(16) unsigned NOT NULL default '0',
-  `name` varchar(30) default NULL,
   `supervisor` int(16) unsigned default NULL,
   `valid` tinyint(1) default NULL,
   PRIMARY KEY  (`district`)
@@ -103,10 +102,11 @@ CREATE TABLE `tc_district` (
 --
 -- Table structure for table `tc_individual`
 --
-CREATE TABLE `tc_individual` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_individual` (
   `individual` int(16) unsigned NOT NULL auto_increment,
   `mls_id` int(16) unsigned NOT NULL,
   `name` varchar(60) default NULL,
+  `fullname` varchar(60) default NULL,
   `address` varchar(255) default NULL,
   `phone` varchar(12) default NULL,
   `email` varchar(120) default NULL,
@@ -122,11 +122,8 @@ CREATE TABLE `tc_individual` (
 --
 -- Table structure for table `tc_family`
 --
-CREATE TABLE `tc_family` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_family` (
   `family` int(16) unsigned NOT NULL auto_increment,
-  `hofh_id` int(16) unsigned NOT NULL default '0',
-  `name` varchar(30) NOT NULL default '',
-  `name_id` varchar(30) NOT NULL default '',
   `individual` int(16) unsigned default '0',
   `companionship` int(16) unsigned default NULL,
   `scheduling_priority` int(16) unsigned default NULL,
@@ -137,7 +134,7 @@ CREATE TABLE `tc_family` (
 --
 -- Table structure for table `tc_participation`
 --
-CREATE TABLE `tc_participation` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_participation` (
   `individual` int(16) unsigned NOT NULL default '0',
   `activity` int(16) unsigned default NULL,
   UNIQUE KEY `activity_ndx` (`individual`,`activity`)
@@ -146,25 +143,24 @@ CREATE TABLE `tc_participation` (
 --
 -- Table structure for table `tc_interview`
 --
-CREATE TABLE `tc_interview` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_interview` (
   `interview` int(16) unsigned NOT NULL auto_increment,
   `interviewer` int(16) unsigned default NULL,
   `individual` int(16) unsigned default NULL,
   `date` date default NULL,
   `notes` text,
   `interview_type` enum('hti','ppi') NOT NULL DEFAULT 'hti',
-  PRIMARY KEY  (`ppi`)
+  PRIMARY KEY  (`interview`)
 ) ENGINE=MyISAM AUTO_INCREMENT=248 DEFAULT CHARSET=latin1;
 
 
 --
 -- Table structure for table `tc_presidency`
 --
-CREATE TABLE `tc_presidency` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_presidency` (
   `presidency` int(16) unsigned NOT NULL auto_increment,
   `individual` int(16) unsigned NOT NULL default '0',
   `district` int(16) unsigned default '0',
-  `name` varchar(60) NOT NULL,
   `email` varchar(60) NOT NULL,
   `president` tinyint(1) default '0',
   `counselor` tinyint(1) default '0',
@@ -177,7 +173,7 @@ CREATE TABLE `tc_presidency` (
 --
 -- Table structure for table `tc_visit`
 --
-CREATE TABLE `tc_visit` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_visit` (
   `visit` int(16) unsigned NOT NULL auto_increment,
   `family` int(16) unsigned default NULL,
   `companionship` int(16) unsigned default NULL,
@@ -193,7 +189,7 @@ CREATE TABLE `tc_visit` (
 --
 -- Table structure for table `tc_willingness`
 --
-CREATE TABLE `tc_willingness` (
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_willingness` (
   `individual` int(16) unsigned NOT NULL,
   `assignment` int(16) unsigned NOT NULL,
   `willing` enum('y','n','') NOT NULL,
@@ -203,24 +199,82 @@ CREATE TABLE `tc_willingness` (
 --
 -- Table structure for table `tc_scheduling_priority`
 --
-CREATE TABLE `phpgroupware`.`tc_scheduling_priority` (
-`scheduling_priority` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`priority` INT( 10 ) UNSIGNED NOT NULL DEFAULT '30',
-`notes` VARCHAR( 128 ) NOT NULL DEFAULT ''
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_scheduling_priority` (
+  `scheduling_priority` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `priority` INT( 10 ) UNSIGNED NOT NULL DEFAULT '30',
+  `notes` VARCHAR( 128 ) NOT NULL DEFAULT ''
 ) ENGINE = MYISAM ;
 
 --
 -- Table structure for table `tc_email_list`
 --
-CREATE TABLE `phpgroupware`.`tc_email_list` (
-`email_list` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`name` VARCHAR( 128 ) NULL DEFAULT NULL
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_email_list` (
+  `email_list` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `name` VARCHAR( 128 ) NULL DEFAULT NULL
 ) ENGINE = MYISAM ;
 
 --
 -- Table structure for table `tc_email_list_membership`
 --
-CREATE TABLE `phpgroupware`.`tc_email_list_membership` (
-`individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL ,
-`email_list` INT( 16 ) UNSIGNED NULL DEFAULT NULL
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_email_list_membership` (
+  `individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL ,
+  `email_list` INT( 16 ) UNSIGNED NULL DEFAULT NULL
 ) ENGINE = MYISAM ;
+
+--
+-- Table structure for table `tc_accomplishment`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_accomplishment` (
+  `accomplishment` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL ,
+  `date` DATE NULL DEFAULT NULL ,
+  `task` INT( 16 ) UNSIGNED NULL DEFAULT NULL ,
+  `note` VARCHAR( 128 ) NOT NULL
+) ENGINE = MYISAM ;
+
+--
+-- Table structure for table `tc_task`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_task` (
+  `task` INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `name` VARCHAR( 128 ) NOT NULL ,
+  `description` VARCHAR( 128 ) NOT NULL
+) ENGINE = MYISAM ;
+
+--
+-- Table structure for table `tc_district_sandbox`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_district_sandbox` (
+  `district` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+  `supervisor` INT( 16 ) UNSIGNED NULL DEFAULT NULL
+) ENGINE = MYISAM ;
+
+--
+-- Table structure for table `tc_companion_sandbox`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_companion_sandbox` (
+  `companion` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `individual` INT( 16 ) UNSIGNED NOT NULL ,
+  `companionship` INT( 16 ) UNSIGNED NOT NULL
+) ENGINE = MYISAM ;
+
+--
+-- Table structure for table `tc_companionship_sandbox`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_companionship_sandbox` (
+  `companionship` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `tc_companionship` INT( 16 ) UNSIGNED NOT NULL ,
+  `district` INT( 16 ) UNSIGNED NULL DEFAULT NULL
+) ENGINE = MYISAM ;
+
+--
+-- Table structure for table `tc_family_sandbox`
+--
+CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_family_sandbox` (
+  `family` int(16) unsigned NOT NULL auto_increment,
+  `tc_family` int(16) unsigned default '0',
+  `individual` INT( 16 ) UNSIGNED NOT NULL ,
+  `companionship` int(16) unsigned default NULL,
+  PRIMARY KEY  (`family`)
+) ENGINE = MyISAM ;
+