 );
 
 /**
+* Contains the Sahana system user details
+* Modules: all
+* Last changed: 27-OCT-2005 - ravindra@opensource.lk  
+*/
+DROP TABLE IF EXISTS users;
+CREATE TABLE users (
+    p_uuid VARCHAR(60) NOT NULL,  -- reference to the persons uuid
+    user_name VARCHAR(100) NOT NULL,
+    password VARCHAR(100),
+    PRIMARY KEY (p_uuid),
+    FOREIGN KEY (p_uuid) REFERENCES person_uuid(p_uuid)
+);
+
+/** 
+ * User Preferences
+ * Modules : Framework
+ * Created : 28th-Mar-2006 - janaka@opensource.lk
+ * Last Change : 28th-Mar-2006  - janaka@opensource.lk
+ */
+
+DROP TABLE IF EXISTS user_preference;
+CREATE TABLE user_preference(
+    p_uuid VARCHAR(60) NOT NULL,
+    module_id VARCHAR(20) NOT NULL,
+    pref_key     VARCHAR(60) NOT NULL,
+    value   VARCHAR(100),
+    FOREIGN KEY (p_uuid) REFERENCES person_uuid (p_uuid),
+    FOREIGN KEY (module_id) REFERENCES modules (module_id),
+    PRIMARY KEY (p_uuid,module_id,pref_key)
+);
+
+
+/**
+* Contains the the information on the sector that the org 
+* group or person is involved in 
+* Modules: all
+* Last changed: 27-OCT-2005 - ravindra@opensource.lk  
+*/
+DROP TABLE IF EXISTS sector;
+CREATE TABLE sector(
+	pgoc_uuid VARCHAR(60) NOT NULL,
+	opt_sector VARCHAR(100),
+    PRIMARY KEY (pgoc_uuid, opt_sector)
+);
+
+/**
+* Auditor log table 
+* Modules: dvr, mpr, 
+* Created : 21-Dec-2005 - janaka@opensource.lk
+*/
+DROP TABLE IF EXISTS audit;
+CREATE TABLE audit (
+    audit_id BIGINT NOT NULL AUTO_INCREMENT,
+    updated TIMESTAMP NOT NULL DEFAULT NOW(),
+    x_uuid VARCHAR(60) NOT NULL,
+    u_uuid VARCHAR(60) NOT NULL,
+    change_type VARCHAR(3) NOT NULL,
+    change_table VARCHAR(100) NOT NULL,
+    change_field VARCHAR(100) NOT NULL,
+    prev_val TEXT,
+    new_val TEXT,
+    PRIMARY KEY(audit_id)
+);
+
+
+
+/**================= Entity: Location, GIS, GPS  ===================**/
+
+/**
+* The central table to store loactions
+* Modules: dvr, mpr, rms, or, cms 
+* Last changed: 28-OCT-2005 - janaka@opensource.lk  
+*/
+DROP TABLE IF EXISTS location;
+CREATE TABLE location(
+    loc_uuid VARCHAR(60) NOT NULL, -- universally unique location id,
+    parent_id VARCHAR(60) DEFAULT NULL, -- parent location id
+ --   search_id VARCHAR(20), -- a heirarchical id expressing the heirarachy
+    opt_location_type VARCHAR(10), -- location type taken from field_opts
+    name VARCHAR(100) NOT NULL,
+    iso_code VARCHAR(20),
+    description TEXT,
+    PRIMARY KEY (loc_uuid),
+    FOREIGN KEY (parent_id) REFERENCES location(loc_uuid)
+);
+
+/**
 * Details on the location of an entity (person, camp, organization)
 * Modules: dvr, mpr, or, cms, rms 
 * Last changed: 27-OCT-2005 - ravindra@opensource.lk  

    FOREIGN KEY (location) REFERENCES location(loc_uuid)
);


-- ORG MAIN
DROP TABLE IF EXISTS org_main;
CREATE TABLE org_main(
	o_uuid VARCHAR(60) NOT NULL,

CREATE TABLE camp_reg (
    c_uuid VARCHAR(60) NOT NULL,
    admin_name VARCHAR(60),
    admin_no VARCHAR(60),
    men INT,
    women INT,
    family INT,
    children INT,
