CREATE TABLE IF NOT EXISTS `set_route_details` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `route_no` varchar(255) NOT NULL,
  `set_id` int(11) NOT NULL,
  `route_desc` varchar(255) DEFAULT NULL,
  `part_no` varchar(50) DEFAULT NULL,
  `previous_part_no` varchar(50) DEFAULT NULL,
  `operation` varchar(100) DEFAULT NULL,
  `machine_lock` tinyint(1) DEFAULT NULL,
  `machine_high_priority` varchar(50) DEFAULT NULL,
  `machine_medium_priority` varchar(50) DEFAULT NULL,
  `machine_low_priority` varchar(50) DEFAULT NULL,
  `machine_rate` decimal(10,2) DEFAULT NULL,
  `set_time` time DEFAULT NULL,
  `operation_time` varchar(50) DEFAULT NULL,
  `operation_unit` varchar(255) NOT NULL,
  `parts_per_operation` decimal(10,2) DEFAULT NULL,
  `workers_needed` decimal(10,2) DEFAULT NULL,
  `labour_rate` decimal(10,2) DEFAULT NULL,
  `notes` text,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
)
24-03-2025
DROP TABLE IF EXISTS `group_mangmnt`;
CREATE TABLE IF NOT EXISTS `group_mangmnt` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` int(11) NOT NULL,
  `group_number` int(11) NOT NULL,  
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);
ALTER TABLE `set_mangmnt` CHANGE `description` `description` TEXT NOT NULL;


DROP TABLE IF EXISTS `group_mangmnt_mapping`;
CREATE TABLE IF NOT EXISTS `group_mangmnt_mapping` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `part_number` int(11) NOT NULL,
  PRIMARY KEY (`id`)
);
21-03-2025
DROP TABLE IF EXISTS `set_mangmnt`;
CREATE TABLE IF NOT EXISTS `set_mangmnt` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` TEXT NOT NULL,
  `set_number` int(11) NOT NULL,  
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);
ALTER TABLE `set_mangmnt` CHANGE `description` `description` TEXT NOT NULL;


DROP TABLE IF EXISTS `set_mangmnt_mapping`;
CREATE TABLE IF NOT EXISTS `set_mangmnt_mapping` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `set_id` int(11) NOT NULL,
  `part_number` int(11) NOT NULL,
  `quantity` int(11) NOT NULL,
  PRIMARY KEY (`id`)
);
10-03-2025
CREATE TABLE work_logs (
    id INT AUTO_INCREMENT PRIMARY KEY,
    engineer_id INT,
    work_order_id INT,
    start_time DATETIME,
    end_time DATETIME,
    quantity INT,
    scrap INT,
    rework INT,
    progress_notes TEXT,
    FOREIGN KEY (engineer_id) REFERENCES engineers(id),
    FOREIGN KEY (work_order_id) REFERENCES work_orders(id)
); 
CREATE TABLE assign_work_order (
    id INT AUTO_INCREMENT PRIMARY KEY,
    work_order_no int NOT NULL,
    machine_scedule_date  datetime NOT NULL,
    work_order_sched_date  datetime NOT NULL,
    engineer_id INT NOT NULL,
    created_by INT NOT NULL,
    created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_by INT,
    updated_on DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

07-03-2025
CREATE TABLE production_planning (
    id INT AUTO_INCREMENT PRIMARY KEY,
    part_number TEXT NOT NULL,
    customer_reff TEXT NOT NULL,
    req_date DATE NOT NULL,
    req_qty INT NOT NULL,
    created_by INT NOT NULL,
    created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_by INT,
    updated_on DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

28-01-2025
ALTER TABLE `item_management` CHANGE `mpe` `mpe` VARCHAR(255) NULL DEFAULT NULL, CHANGE `gross` `gross` VARCHAR(255) NULL DEFAULT NULL, CHANGE `net` `net` VARCHAR(255) NULL DEFAULT NULL, CHANGE `uom` `uom` INT NOT NULL, CHANGE `price_uom` `price_uom` INT NOT NULL, CHANGE `scrap_value` `scrap_value` INT NULL DEFAULT NULL, CHANGE `type_2` `type_2` INT NOT NULL;
ALTER TABLE `item_management` CHANGE `scrap_percent` `scrap_percent` VARCHAR(255) NULL DEFAULT NULL;

13-01-2025
CREATE TABLE returns_notes_mapping (
    id INT AUTO_INCREMENT PRIMARY KEY,
    description TEXT NOT NULL,
    unit_price TEXT NOT NULL,
    created_by INT NOT NULL,
    created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_by INT,
    updated_on DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

CREATE TABLE invoice_footer_detais (
    id INT AUTO_INCREMENT PRIMARY KEY,
    our_details TEXT NOT NULL,
    our_accreditations TEXT NOT NULL,
    bottom_text TEXT NOT NULL,
    created_by INT NOT NULL,
    created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_by INT,
    updated_on DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

07-01-2025
CREATE TABLE sales_invoices (
    invoice_id INT AUTO_INCREMENT PRIMARY KEY,
    invoice_number VARCHAR(50) NOT NULL,
    invoice_date DATE NOT NULL,
    order_number VARCHAR(50) NOT NULL,
    customer_id INT NOT NULL,
    ship_id INT NOT NULL,
    vendor_id INT NOT NULL,
    invoice_address_1 VARCHAR(255),
    invoice_address_2 VARCHAR(255),
    invoice_address_3 VARCHAR(255),
    invoice_add_postcode VARCHAR(20),
    delivery_address_1 VARCHAR(255),
    delivery_address_2 VARCHAR(255),
    delivery_address_3 VARCHAR(255),
    delivery_add_postcode VARCHAR(20),
    delivery_add_id INT,
    created_by INT NOT NULL,
    created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_by INT,
    updated_on DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE sales_invoice_mapping (
    sales_id INT AUTO_INCREMENT PRIMARY KEY,
    quantity INT NOT NULL,
    ordering INT NOT NULL,
    order_number_mpp VARCHAR(50) NOT NULL,
    part_number VARCHAR(50) NOT NULL,
    description TEXT,
    issue VARCHAR(255),
    unit_price DECIMAL(10, 2) NOT NULL,
    total DECIMAL(10, 2) NOT NULL,
    created_by INT NOT NULL,
    created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_by INT,
    updated_on DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);



02-01-2025


DROP TABLE IF EXISTS `purchase_order_items_mapping`;
CREATE TABLE IF NOT EXISTS `purchase_order_items_mapping` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `po_id` int(11) NOT NULL,
  `ordering` int(11) NOT NULL,
  `item_type` int(11) NOT NULL,
  `part_number` int(11) NOT NULL,
  `description` text NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` int(11) NOT NULL,
  `total` int(11) NOT NULL,
  `expected_date` datetime NOT NULL,
  `received` int(11) NOT NULL,
  `is_reviewed` tinyint(1) DEFAULT '0',
  `review_notes` text,
  `status` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
)




DROP TABLE IF EXISTS `purchase_slips`;
CREATE TABLE IF NOT EXISTS `purchase_slips` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `purchase_order_mapp_id` int(11) DEFAULT NULL,
  `qty_received` int(11) DEFAULT NULL,
  `slip_date` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) 

13-12-2024
DROP TABLE IF EXISTS `set_mangmnt`;
CREATE TABLE IF NOT EXISTS `set_mangmnt` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` int(11) NOT NULL,
  `set_number` int(11) NOT NULL,  
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);
ALTER TABLE `set_mangmnt` CHANGE `description` `description` TEXT NOT NULL;


DROP TABLE IF EXISTS `set_mangmnt_mapping`;
CREATE TABLE IF NOT EXISTS `set_mangmnt_mapping` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `set_id` int(11) NOT NULL,
  `part_number` int(11) NOT NULL,
  PRIMARY KEY (`id`)
);
29-11-2024

05-12-2024
DROP TABLE IF EXISTS `work_order_planning`;
CREATE TABLE IF NOT EXISTS `work_order_planning` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `route_no` varchar(255) NOT NULL,
  `works_order_no` varchar(100) DEFAULT NULL,
  `operation` varchar(100) DEFAULT NULL,
  `primary_resource` int(11) DEFAULT NULL,
  `plan_rate` decimal(10,2) DEFAULT NULL,
  `set_time` time DEFAULT NULL,
  `operation_time` varchar(50) DEFAULT NULL,
  `status` int(11) DEFAULT NULL,
  `planned_qty` int(11) DEFAULT NULL,
  `required_by` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
)

DROP TABLE IF EXISTS `route_details`;
CREATE TABLE IF NOT EXISTS `route_details` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `route_no` varchar(255) NOT NULL,
  `item_id` int(11) NOT NULL,
  `route_desc` varchar(255) DEFAULT NULL,
  `part_no` varchar(50) DEFAULT NULL,
  `previous_part_no` varchar(50) DEFAULT NULL,
  `operation` varchar(100) DEFAULT NULL,
  `machine_lock` tinyint(1) DEFAULT NULL,
  `machine_high_priority` varchar(50) DEFAULT NULL,
  `machine_medium_priority` varchar(50) DEFAULT NULL,
  `machine_low_priority` varchar(50) DEFAULT NULL,
  `machine_rate` decimal(10,2) DEFAULT NULL,
  `set_time` time DEFAULT NULL,
  `operation_time` varchar(50) DEFAULT NULL,
  `operation_unit` varchar(255) NOT NULL,
  `parts_per_operation` decimal(10,2) DEFAULT NULL,
  `workers_needed` decimal(10,2) DEFAULT NULL,
  `labour_rate` decimal(10,2) DEFAULT NULL,
  `notes` text,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
)
18-11-2024
ALTER TABLE `item_management` ADD `part_number_id` INT NOT NULL AFTER `part_number`;


CREATE TABLE `video_link` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module_name` varchar(255) NOT NULL,
  `section` varchar(255) NOT NULL,
  `video_link` varchar(255) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
)
08-11-2024
DROP TABLE IF EXISTS `holiday_management`;
CREATE TABLE IF NOT EXISTS `holiday_management` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `employee_name` varchar(255) NOT NULL,
  `clock_no` varchar(255) NOT NULL,
  `holiday_start_date` datetime NOT NULL,  
  `holiday_end_date` datetime NOT NULL,  
  `date_submitted_finance` datetime NOT NULL,  
  `holiday_auth_date_time` datetime NOT NULL,  
  `no_of_day` int NOT NULL,  
  `is_authorised` int NOT NULL,  
  `paid_week_num` int NOT NULL,  
  `holiday_authorised_by` varchar(255) NOT NULL,
  `enterd_pro_iv` varchar(255) NOT NULL,
  
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);

30-10-2024
DROP TABLE IF EXISTS `quot_brought_total`;
CREATE TABLE IF NOT EXISTS `quot_brought_total` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quot_id` int(11) NOT NULL,
  `totals_brought` int(11) NOT NULL,
  `handling_brought` text NOT NULL,  
  `scrap_brought` int(11) NOT NULL ,
  `average_brought` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);
ALTER TABLE `quot_brought_total` CHANGE `handling_brought` `handling_brought` INT NOT NULL;
ALTER TABLE `quot_brought_total` CHANGE `totals_brought` `totals_brought` VARCHAR(100) NOT NULL, CHANGE `handling_brought` `handling_brought` VARCHAR(100) NOT NULL, CHANGE `scrap_brought` `scrap_brought` VARCHAR(100) NOT NULL, CHANGE `average_brought` `average_brought` VARCHAR(100) NOT NULL;

ALTER TABLE `quot_brought` CHANGE `exch_rate` `exch_rate` INT NOT NULL;
28-10-2024
DROP TABLE IF EXISTS `quot_logistics`;
CREATE TABLE IF NOT EXISTS `quot_logistics` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quot_id` int(11) NOT NULL,
  `logistics` int(11) NOT NULL,
  `transport` text NOT NULL,  
  `pcost` text NOT NULL,  
  `packaging` text NOT NULL,  
  `pacost` text NOT NULL,  
  `pallet` text NOT NULL,  
  `palcost` text NOT NULL,  
  `other` text NOT NULL,  
  `status` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);
ALTER TABLE `quot_logistics` ADD `othcost` VARCHAR(255) NOT NULL AFTER `other`;

DROP TABLE IF EXISTS `quot_feasibility`;
CREATE TABLE IF NOT EXISTS `quot_feasibility` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quot_id` int(11) NOT NULL,
  `fsb_type` int(11) NOT NULL,
  `issue_concern` text NOT NULL,  
  `status` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);


25-10-2024
ALTER TABLE `quot_brought` ADD `status` INT NOT NULL DEFAULT '0' AFTER `scrap`;
ALTER TABLE `quot_raw_materials` ADD `status` INT NOT NULL DEFAULT '0' AFTER `unit_cost`;
22-10-2024

DROP TABLE IF EXISTS `quotation`;
CREATE TABLE IF NOT EXISTS `quotation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quotation_number` varchar(255) NOT NULL,
  `customer_id` int(11) NOT NULL,
  `enquiry_id` int(11) NOT NULL,
  `part_number` varchar(255) NOT NULL,
  `part_description` text NOT NULL,
  `model_number` varchar(255) NOT NULL,
  `drawing_issue` varchar(255) NOT NULL,
  `volume` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  `anuual_value` text NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);


11-10-2024
DROP TABLE IF EXISTS `inventory`;
CREATE TABLE IF NOT EXISTS `inventory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `item_id` int(11) NOT NULL,
  `quantity_in_stock` int(11) NOT NULL,
  `quantity_allocated` int(11) NOT NULL,
  `minimum_stock` int(11) NOT NULL,
  `maximum_stock` int(11) NOT NULL,
  `minimum_ebq` int(11) NOT NULL,
  `maximum_ebq` int(11) NOT NULL,
  `standard_cost_ebq` decimal(10,2) NOT NULL,
  `default_workshop` char(2) DEFAULT NULL,
  `default_receipt_location` char(2) DEFAULT NULL,
  `default_issue_location` char(2) DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `item_management_id` (`item_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;



08-10-2024
CREATE TABLE `thermotec`.`item_images` ( `id` INT NOT NULL AUTO_INCREMENT , `product_id` INT NOT NULL , `product_image` VARCHAR(255) NOT NULL , `created_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`));


DROP TABLE IF EXISTS `item_management`;
CREATE TABLE IF NOT EXISTS `item_management` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `part_number` varchar(255) NOT NULL,
  `product_description` varchar(255) NOT NULL,
  `part_status` varchar(50) NOT NULL,
  `usual_source` varchar(50) DEFAULT NULL,
  `stock_uom` varchar(50) NOT NULL,
  `drawing_number` varchar(255) DEFAULT NULL,
  `product_group` varchar(50) DEFAULT NULL,
  `man_lead_time` int(11) DEFAULT NULL,
  `standard_cost_ebq` decimal(10,2) NOT NULL,
  `pack_quantity` int(11) NOT NULL,
  `pack_weight` decimal(10,2) DEFAULT NULL,
  `pallet_quantity` int(11) DEFAULT NULL,
  `standard_cost` decimal(10,2) NOT NULL,
  `nominal_code_sales` varchar(255) DEFAULT NULL,
  `nominal_code_purchase` varchar(255) DEFAULT NULL,
  `date_time_amended` datetime DEFAULT NULL,
  `date_time_amended_utc` datetime DEFAULT NULL,
  `packing_code` varchar(255) DEFAULT NULL,
  `recycle_code` varchar(255) DEFAULT NULL,
  `drawing_issue` varchar(255) DEFAULT NULL,
  `uph` decimal(10,2) DEFAULT NULL,
  `cnc_program_no` varchar(255) DEFAULT NULL,
  `customer_code` varchar(255) DEFAULT NULL,
  `master_sample_location` varchar(255) DEFAULT NULL,
  `tool_location` varchar(255) DEFAULT NULL,
  `checking_fixture_location` varchar(255) DEFAULT NULL,
  `type` varchar(50) NOT NULL,
  `spec` varchar(255) DEFAULT NULL,
  `grade` varchar(255) DEFAULT NULL,
  `format` varchar(255) DEFAULT NULL,
  `density` decimal(10,2) DEFAULT NULL,
  `mpe` decimal(10,2) DEFAULT NULL,
  `length_mm` decimal(10,2) NOT NULL,
  `width_mm` decimal(10,2) NOT NULL,
  `thickness` decimal(10,2) NOT NULL,
  `mks` int(11) DEFAULT NULL,
  `gross` decimal(10,2) DEFAULT NULL,
  `net` decimal(10,2) DEFAULT NULL,
  `scrap_percent` decimal(5,2) DEFAULT NULL,
  `uom` varchar(50) NOT NULL,
  `price_uom` varchar(50) NOT NULL,
  `unit_cost` decimal(10,2) NOT NULL,
  `scrap_value` decimal(10,2) DEFAULT NULL,
  `type_2` varchar(255) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL,
  PRIMARY KEY (`id`)
) 
23-09-2024

CREATE TABLE `admin` (
  `id` int(11) NOT NULL,
  `user_reference` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `first_name` varchar(255) NOT NULL,
  `surname` varchar(255) NOT NULL,
  `department` int(11) NOT NULL,
  `address_1` varchar(255) NOT NULL,
  `address_2` varchar(255) DEFAULT NULL,
  `address_3` varchar(255) DEFAULT NULL,
  `post_code` varchar(255) DEFAULT NULL,
  `mobile` varchar(255) DEFAULT NULL,
  `home_phone` varchar(255) DEFAULT NULL,
  `start_date` datetime NOT NULL,
  `leave_date` datetime DEFAULT NULL,
  `ni_number` varchar(9) NOT NULL,
  `pension` int(11) NOT NULL,
  `kin1_name` varchar(255) NOT NULL,
  `kin1_address_1` varchar(255) NOT NULL,
  `kin1_address_2` varchar(255) DEFAULT NULL,
  `kin1_address_3` varchar(255) DEFAULT NULL,
  `kin1_post_code` varchar(255) DEFAULT NULL,
  `kin1_relationship` varchar(255) NOT NULL,
  `kin1_phone` varchar(255) NOT NULL,
  `kin1_phone_type` int(11) NOT NULL,
  `kin2_name` varchar(255) DEFAULT NULL,
  `kin2_address_1` varchar(255) DEFAULT NULL,
  `kin2_address_2` varchar(255) DEFAULT NULL,
  `kin2_address_3` varchar(255) DEFAULT NULL,
  `kin2_post_code` varchar(255) DEFAULT NULL,
  `kin2_relationship` varchar(255) DEFAULT NULL,
  `kin2_phone` varchar(255) DEFAULT NULL,
  `kin2_phone_type` int(11) DEFAULT NULL,
  `doctor_name` varchar(255) DEFAULT NULL,
  `doctor_address_1` varchar(255) DEFAULT NULL,
  `doctor_address_2` varchar(255) DEFAULT NULL,
  `doctor_post_code` varchar(255) DEFAULT NULL,
  `doctor_phone` varchar(255) DEFAULT NULL,
  `bank_name` varchar(255) NOT NULL,
  `bank_address_1` varchar(255) NOT NULL,
  `bank_address_2` varchar(255) DEFAULT NULL,
  `bank_post_code` varchar(255) DEFAULT NULL,
  `account_no` varchar(255) NOT NULL,
  `sort_code` varchar(6) NOT NULL,
  `personal_ref_no` varchar(255) DEFAULT NULL,
  `session_history` varchar(255) NOT NULL,
  `admin_color` varchar(25) NOT NULL,
  `is_super_admin` int(11) NOT NULL,
  `is_active` int(11) NOT NULL,
  `access_control` tinyint(1) DEFAULT NULL,
  `is_representative` tinyint(4) NOT NULL,
  `group_id` int(11) NOT NULL,
  `show_only_my_things` tinyint(4) NOT NULL,
  `signature` varchar(255) NOT NULL,
  `site_id` int(11) NOT NULL,
   `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP

)
ALTER TABLE `admin` ADD PRIMARY KEY( `id`);
ALTER TABLE `admin` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;