fixed ordering of interviews/visits so that they show last one, clarified queries...
[eq/.git] / sql / tc.sql
index 71902b6063642629e0f9897c0bcef9871aa04383..25eae9aa6d3f036e7bcb94a134e8bff1524a9fe7 100644 (file)
@@ -70,34 +70,39 @@ CREATE TABLE `tc_attendance` (
 -- Table structure for table `tc_calling`
 --
 CREATE TABLE `tc_calling` (
-  `indiv_id` int(16) unsigned default NULL,
-  `name` varchar(30) default NULL,
+  `individual` int(16) unsigned default '0',
   `organization` varchar(30) default NULL,
   `position` varchar(30) default NULL,
-  `sequence` int(16) unsigned default NULL,
   `sustained` varchar(30) default NULL,
-  KEY `indiv_id` (`indiv_id`)
+  KEY `individual` (`individual`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
 --
--- Table structure for table `tc_companionship`
+-- Table structure for table `tc_companion`
 --
+CREATE TABLE `phpgroupware`.`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 `phpgroupware`.`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` (
   `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`)
@@ -110,10 +115,10 @@ CREATE TABLE `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,
-  `family` int(16) unsigned default NULL,
   `hh_position` enum('Head of Household','Spouse','Other') DEFAULT 'Other',
   `priesthood` enum('High Priest','Elder','Priest','Teacher','Deacon','Unordained') DEFAULT NULL,
   `steward` enum('High Priest','Elder') DEFAULT NULL,
@@ -128,9 +133,6 @@ CREATE TABLE `tc_individual` (
 --
 CREATE TABLE `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,
@@ -157,7 +159,7 @@ CREATE TABLE `tc_interview` (
   `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;
 
 
@@ -168,7 +170,6 @@ CREATE TABLE `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',
@@ -207,8 +208,44 @@ 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 `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 `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 `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 `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 `tc_task` (
+  `task` INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `name` VARCHAR( 128 ) NOT NULL ,
+  `description` VARCHAR( 128 ) NOT NULL
 ) ENGINE = MYISAM ;