     FOREIGN KEY (location_id) REFERENCES location(loc_uuid)
 );
 
-/**
-* Contains the list of groups of people
-* Modules: dvr, mpr, or
-* Last changed: 27-OCT-2005 - chamindra@opensource.lk  
-*/
-DROP TABLE IF EXISTS pgroup;
-CREATE TABLE pgroup (
-    g_uuid VARCHAR(60) NOT NULL, -- universally unique group id
-    name VARCHAR(100), -- name of the group
-    opt_group_type VARCHAR(10), -- type of the group
-    PRIMARY KEY (g_uuid)
-);
-
-/**
-* A person can belong to multiple groups
-* Modules: dvr, mpr
-* Last changed: 27-OCT-2005 - chamindra@opensource.lk  
-*/
-DROP TABLE IF EXISTS person_to_pgroup;
-CREATE TABLE person_to_pgroup (   
-    p_uuid VARCHAR(60),
-    g_uuid VARCHAR(60)
-);
+
+/**================= Entity: Person oriented  ===================**/
+
+/*** PERSON TABLES ***/
+
+/**
+* The central table on a person, with their associated names
+* Modules: dvr, mpr, rms, or, cms 
+* Last changed: 27-OCT-2005 - chamindra@opensource.lk  
+*/
+DROP TABLE IF EXISTS person_uuid;
+CREATE TABLE person_uuid (
+    p_uuid VARCHAR(60) NOT NULL, -- universally unique person id
+    full_name VARCHAR(100), -- the full name (contains the family name)
+    family_name VARCHAR(50), -- the family name
+    l10n_name VARCHAR(100), -- localized version of name
+    custom_name VARCHAR(50), -- extra name field as required
+    PRIMARY KEY(p_uuid)      
+);
+
+/**
+* Many ID card numbers (or passport or driving licence) to person table
+* Modules: dvr, mpr 
+* Last changed: 27-OCT-2005 - chamindra@opensource.lk  
+*/
+DROP TABLE IF EXISTS identity_to_person;
+CREATE TABLE identity_to_person (
+    p_uuid VARCHAR(60) NOT NULL,
+    serial VARCHAR(100), -- id card #, passport #, Driving License # etc
+    opt_id_type VARCHAR(10), -- can be customized in the field options table
+    FOREIGN KEY (p_uuid) REFERENCES person_uuid(p_uuid)
+)
 
 /**
 * The main details on a person

);

/**
* Physical details of a person
* Modules: dvr, mpr, or, cms, rms 
* Last changed: 27-OCT-2005 - chamindra@opensource.lk  

    PRIMARY KEY (incident_id,x_uuid)
);

/**================ PHP and 3rd Party Tables ========================**/

/**
* This is the sessions table that stores the PHP session in the database 
* Modules: all
*/
DROP TABLE IF EXISTS sessions;
CREATE TABLE sessions(
	sesskey VARCHAR(32) NOT NULL,
	expiry INT NOT NULL,
	expireref VARCHAR(64),
	data TEXT NOT NULL,
	PRIMARY KEY (sesskey)
);

-- OPTIMIZATION  DEVEL - @depracated ?
DROP TABLE IF EXISTS devel_logsql;
CREATE TABLE devel_logsql (
    created timestamp NOT NULL, 
    sql0 varchar(250) NOT NULL,
    sql1 text NOT NULL,
    params text NOT NULL,
    tracer text NOT NULL,
    timer decimal(16,6) NOT NULL
); 


/**================= TO BE REMOVED =======================**/
DROP TABLE IF EXISTS camp_org;
CREATE TABLE camp_org(
    c_uuid VARCHAR(60) NOT NULL,
		opt_camp_service VARCHAR(50),
    o_uuid VARCHAR(60) NOT NULL,
		PRIMARY KEY (c_uuid,opt_camp_service,o_uuid)
);

DROP TABLE IF EXISTS camp_admin;
CREATE TABLE camp_admin(
    c_uuid VARCHAR(60) NOT NULL,
    contact_puuid VARCHAR(60) NOT NULL,
		PRIMARY KEY (c_uuid,contact_puuid)
);

/**
* Camps in Camp Management System
*/
 
DROP TABLE IF EXISTS camp_cms;
CREATE TABLE camp_cms(
    c_uuid VARCHAR(60) NOT NULL,
    camp_status VARCHAR(60) NOT NULL,
		PRIMARY KEY (c_uuid)
);

--CUSTOM CONFIGURATION LISTS (SELECT)
DROP TABLE IF EXISTS configlist;
CREATE TABLE configlist(
	description TEXT NOT NULL,
	value VARCHAR(50),
	config_id BIGINT NOT NULL,
	FOREIGN KEY (config_id) REFERENCES config (config_id)
);


