-- https://www.phpmyadmin.net/
--

START TRANSACTION;



-- --------------------------------------------------------

--
-- Table structure for table `authorized_personnel_logs`
--

CREATE TABLE `authorized_personnel_logs` (
  `log_id` int(10) UNSIGNED NOT NULL,
  `log_activity` varchar(200) NOT NULL DEFAULT '',
  `log_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `personnel_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_number` varchar(45) NOT NULL DEFAULT '',
  `name` varchar(300) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `authorized_personnel_logs`
--

INSERT INTO `authorized_personnel_logs` (`log_id`, `log_activity`, `log_datetime`, `personnel_id`, `pr_number`, `name`) VALUES
(229, 'Signed', '2017-06-01 19:30:44', 11, '2017-61192717', 'new budget'),
(230, 'Forwarded', '2017-06-01 19:30:52', 11, '2017-61192717', 'new budget'),
(231, 'Signed', '2017-06-01 19:31:26', 13, '2017-61192717', 'ICU'),
(232, 'Forwarded', '2017-06-01 19:31:33', 13, '2017-61192717', 'ICU'),
(233, 'Signed', '2017-06-01 19:32:11', 14, '2017-61192717', 'President'),
(234, 'Forwarded', '2017-06-01 19:32:28', 14, '2017-61192717', 'President'),
(235, 'Unsigned', '2017-06-01 19:48:58', 11, '2017-61194714', 'new budget'),
(236, 'Signed', '2017-06-02 09:42:24', 11, '2017-629100', 'new budget'),
(237, 'Forwarded', '2017-06-02 09:46:48', 11, '2017-629100', 'new budget'),
(238, 'Signed', '2017-06-02 09:48:30', 13, '2017-629100', 'ICU'),
(239, 'Forwarded', '2017-06-02 09:48:39', 13, '2017-629100', 'ICU'),
(240, 'Signed', '2017-06-02 09:49:36', 14, '2017-629100', 'President'),
(241, 'Forwarded', '2017-06-02 09:49:49', 14, '2017-629100', 'President'),
(242, 'Obligate', '2017-06-02 10:09:39', 11, '2017-629100', 'new budget'),
(243, 'Obligate', '2017-06-02 10:14:26', 11, '2017-61192717', 'new budget'),
(244, 'Signed', '2017-06-02 10:18:30', 12, '2017-629100', 'Accounting'),
(245, 'Signed', '2017-06-02 10:19:04', 12, '2017-61192717', 'Accounting'),
(246, 'Forwarded', '2017-06-02 10:22:41', 12, '2017-629100', 'Accounting'),
(247, 'Forwarded', '2017-06-02 10:22:43', 12, '2017-629100', 'Accounting'),
(248, 'Approved', '2017-06-02 10:25:03', 10, '2017-629100', 'D'),
(249, 'Forwarded', '2017-06-02 10:25:24', 10, '2017-629100', 'D'),
(250, 'Signed', '2017-06-02 14:44:09', 11, '2017-62144225', 'new budget'),
(251, 'Forwarded', '2017-06-02 14:47:30', 11, '2017-62144225', 'new budget'),
(252, 'Signed', '2017-06-02 14:53:13', 13, '2017-62144225', 'ICU'),
(253, 'Forwarded', '2017-06-02 14:53:19', 13, '2017-62144225', 'ICU'),
(254, 'Signed', '2017-06-02 14:54:00', 14, '2017-62144225', 'President'),
(255, 'Forwarded', '2017-06-02 14:54:07', 14, '2017-62144225', 'President'),
(256, 'Obligate', '2017-06-02 14:56:33', 11, '2017-62144225', 'new budget'),
(257, 'Signed', '2017-06-02 14:57:57', 12, '2017-62144225', 'Accounting'),
(258, 'Forwarded', '2017-06-02 14:58:05', 12, '2017-62144225', 'Accounting'),
(259, 'Approved', '2017-06-02 14:58:54', 10, '2017-62144225', 'D'),
(260, 'Signed', '2017-06-05 10:22:20', 11, '2017-62211155', 'new budget'),
(261, 'Forwarded', '2017-06-05 10:22:39', 11, '2017-62211155', 'new budget'),
(262, 'Signed', '2017-06-05 10:23:10', 13, '2017-62211155', 'ICU'),
(263, 'Forwarded', '2017-06-05 10:23:18', 13, '2017-62211155', 'ICU'),
(264, 'Signed', '2017-06-05 10:23:49', 14, '2017-62211155', 'President'),
(265, 'Forwarded', '2017-06-05 10:24:05', 14, '2017-62211155', 'President'),
(266, 'Obligate', '2017-06-05 10:27:21', 11, '2017-62211155', 'new budget'),
(267, 'Signed', '2017-06-05 10:30:26', 12, '2017-62211155', 'Accounting'),
(268, 'Forwarded', '2017-06-05 17:44:53', 12, '2017-62211155', 'Accounting'),
(269, 'Forwarded', '2017-06-05 17:44:54', 12, '2017-62211155', 'Accounting'),
(270, 'Signed', '2017-06-05 17:48:29', 11, '2017-65174648', 'new budget'),
(271, 'Forwarded', '2017-06-05 17:48:35', 11, '2017-65174648', 'new budget'),
(272, 'Signed', '2017-06-05 17:49:04', 13, '2017-65174648', 'ICU'),
(273, 'Forwarded', '2017-06-05 17:49:10', 13, '2017-65174648', 'ICU'),
(274, 'Signed', '2017-06-05 17:49:43', 14, '2017-65174648', 'President'),
(275, 'Forwarded', '2017-06-05 17:49:54', 14, '2017-65174648', 'President'),
(276, 'Signed', '2017-06-06 13:14:49', 11, '2017-66115322', 'Maria Luisa Talaboc'),
(277, 'Forwarded', '2017-06-06 13:22:55', 11, '2017-66115322', 'Maria Luisa Talaboc'),
(278, 'Signed', '2017-06-06 13:47:33', 13, '2017-66115322', 'Lucio G. Jabilles'),
(279, 'Forwarded', '2017-06-06 13:56:07', 13, '2017-66115322', 'Lucio G. Jabilles'),
(280, 'Signed', '2017-06-06 14:22:11', 14, '2017-66115322', 'Edito B. Sumile'),
(281, 'Forwarded', '2017-06-06 14:23:17', 14, '2017-66115322', 'Edito B. Sumile'),
(282, 'Signed', '2017-06-07 10:13:08', 11, '2017-6795051', 'Maria Luisa Talaboc'),
(283, 'Forwarded', '2017-06-07 10:33:04', 11, '2017-6795051', 'Maria Luisa Talaboc'),
(284, 'Obligate', '2017-06-07 14:24:18', 11, '2017-66115322', 'Maria Luisa Talaboc'),
(285, 'Obligate', '2017-06-07 14:24:19', 11, '2017-66115322', 'Maria Luisa Talaboc'),
(286, 'Signed', '2017-06-07 14:25:51', 12, '2017-66115322', 'Accounting'),
(287, 'Forwarded', '2017-06-07 14:26:11', 12, '2017-66115322', 'Accounting'),
(288, 'Approved', '2017-06-07 14:27:33', 10, '2017-66115322', 'D'),
(289, 'Forwarded', '2017-06-07 14:32:20', 10, '2017-66115322', 'D');

-- --------------------------------------------------------

--
-- Table structure for table `director`
--

CREATE TABLE `director` (
  `d_id` int(10) UNSIGNED NOT NULL,
  `personnel_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_number` varchar(100) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `end_user_logs`
--

CREATE TABLE `end_user_logs` (
  `log_id` int(10) UNSIGNED NOT NULL,
  `log_activity` varchar(200) NOT NULL DEFAULT '',
  `log_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_number` varchar(45) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `end_user_notification`
--

CREATE TABLE `end_user_notification` (
  `notification_id` int(10) UNSIGNED NOT NULL,
  `notification_description` varchar(1000) NOT NULL DEFAULT '',
  `notification_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `notification_status` enum('Read','Unread') DEFAULT NULL,
  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_tracking_id` varchar(45) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `end_user_purchase_request`
--

CREATE TABLE `end_user_purchase_request` (
  `pr_id` int(10) UNSIGNED NOT NULL,
  `pr_number` varchar(100) NOT NULL DEFAULT '',
  `pr_purpose` varchar(1000) NOT NULL DEFAULT '',
  `pr_status` varchar(200) NOT NULL DEFAULT '',
  `pr_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `head_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_section` varchar(400) NOT NULL DEFAULT '',
  `pr_member_position` varchar(400) NOT NULL DEFAULT '',
  `pr_head_name` varchar(400) NOT NULL DEFAULT '',
  `pr_user_name` varchar(400) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `head_officer_logs`
--

CREATE TABLE `head_officer_logs` (
  `log_id` int(10) UNSIGNED NOT NULL,
  `log_activity` varchar(200) NOT NULL DEFAULT '',
  `log_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `head_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_number` varchar(100) NOT NULL DEFAULT '',
  `name` varchar(300) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `head_officer_logs`
--

INSERT INTO `head_officer_logs` (`log_id`, `log_activity`, `log_datetime`, `head_id`, `pr_number`, `name`) VALUES
(74, 'Signed', '2017-06-01 19:29:17', 1, '2017-61192717', 'head'),
(75, 'Forwarded', '2017-06-01 19:29:31', 1, '2017-61192717', 'head'),
(76, 'Unsigned', '2017-06-01 19:48:13', 1, '2017-61194632', 'head'),
(77, 'Signed', '2017-06-01 19:48:22', 1, '2017-61194714', 'head'),
(78, 'Forwarded', '2017-06-01 19:48:28', 1, '2017-61194714', 'head'),
(79, 'Signed', '2017-06-02 09:18:31', 3, '2017-629100', 'Roy M. Padilla'),
(80, 'Forwarded', '2017-06-02 09:18:50', 3, '2017-629100', 'Roy M. Padilla'),
(81, 'Signed', '2017-06-02 14:43:32', 3, '2017-62144225', 'Roy M. Padilla'),
(82, 'Forwarded', '2017-06-02 14:43:43', 3, '2017-62144225', 'Roy M. Padilla'),
(83, 'Unsigned', '2017-06-02 21:17:16', 3, '2017-62211155', 'Roy M. Padilla'),
(84, 'Signed', '2017-06-02 21:41:08', 3, '2017-62213935', 'Roy M. Padilla'),
(85, 'Unsigned', '2017-06-04 21:54:43', 3, '2017-6421535', 'Roy M. Padilla'),
(86, 'Signed', '2017-06-05 10:21:10', 3, '2017-62211155', 'Roy M. Padilla'),
(87, 'Forwarded', '2017-06-05 10:21:32', 3, '2017-62211155', 'Roy M. Padilla'),
(88, 'Signed', '2017-06-05 17:47:48', 3, '2017-65174648', 'Roy M. Padilla'),
(89, 'Forwarded', '2017-06-05 17:47:59', 3, '2017-65174648', 'Roy M. Padilla'),
(90, 'Signed', '2017-06-06 12:10:14', 6, '2017-66115322', 'Diego P. Tan'),
(91, 'Forwarded', '2017-06-06 12:10:35', 6, '2017-66115322', 'Diego P. Tan'),
(92, 'Signed', '2017-06-07 09:52:34', 6, '2017-6795051', 'Diego P. Tan'),
(93, 'Forwarded', '2017-06-07 09:52:59', 6, '2017-6795051', 'Diego P. Tan');

-- --------------------------------------------------------

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `item_no` int(10) UNSIGNED NOT NULL,
  `item_name` varchar(500) NOT NULL DEFAULT '',
  `item_description` varchar(1000) NOT NULL DEFAULT '',
  `item_unit` varchar(500) NOT NULL DEFAULT '',
  `item_quantity` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_number` varchar(100) NOT NULL DEFAULT '0',
  `item_cost` double NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `message_id` int(10) UNSIGNED NOT NULL,
  `message_conversation_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `message_details` varchar(3000) NOT NULL DEFAULT '',
  `message_status` enum('Read','Unread') DEFAULT NULL,
  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `spu_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `sender` enum('spu_staff','member') DEFAULT NULL,
  `message_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `message_admin_status` varchar(45) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `office`
--

CREATE TABLE `office` (
  `office_id` int(10) UNSIGNED NOT NULL,
  `office_name` varchar(1000) NOT NULL DEFAULT '',
  `office_description` varchar(100) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `office`
--

INSERT INTO `office` (`office_id`, `office_name`, `office_description`) VALUES
(1, 'IT Department', 'it'),
(10, 'Office1', 'Office1'),
(11, 'Demo Farm', 'for Demo Farm'),
(12, 'DAS', 'Sample only');

-- --------------------------------------------------------

--
-- Table structure for table `purchase_request_date_submitted`
--

CREATE TABLE `purchase_request_date_submitted` (
  `prds_id` int(10) UNSIGNED NOT NULL,
  `pr_number` varchar(100) NOT NULL DEFAULT '',
  `pr_date_submitted` date NOT NULL DEFAULT '0000-00-00',
  `budget_officer` varchar(500) NOT NULL DEFAULT '',
  `president` varchar(500) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `purchase_request_track`
--

CREATE TABLE `purchase_request_track` (
  `track_id` int(10) UNSIGNED NOT NULL,
  `activity` varchar(1000) NOT NULL DEFAULT '',
  `personnel_type` varchar(100) NOT NULL DEFAULT '',
  `personnel_name` varchar(500) NOT NULL DEFAULT '',
  `track_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `pr_number` varchar(100) NOT NULL DEFAULT '0',
  `remarks` varchar(1000) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `spu_logs`
--

CREATE TABLE `spu_logs` (
  `log_id` int(10) UNSIGNED NOT NULL,
  `log_activity` varchar(200) NOT NULL DEFAULT '',
  `log_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `spu_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `pr_number` varchar(100) NOT NULL DEFAULT '',
  `name` varchar(300) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `spu_logs`
--

INSERT INTO `spu_logs` (`log_id`, `log_activity`, `log_datetime`, `spu_id`, `pr_number`, `name`) VALUES
(136, 'Bidding', '2017-06-01 19:42:21', 1, '2017-61192717', 'SPU Administrator'),
(137, 'Forward to BAC for signing', '2017-06-01 19:42:36', 1, '2017-61192717', 'SPU Administrator'),
(138, 'Back to SPU for making of Purchase Order (PO)', '2017-06-01 19:42:45', 1, '2017-61192717', 'SPU Administrator'),
(139, 'Forwarded to budget officer', '2017-06-01 19:42:53', 1, '2017-61192717', 'SPU Administrator'),
(140, 'Bidding', '2017-06-02 09:50:53', 1, '2017-629100', 'SPU Administrator'),
(141, 'Forward to BAC for signing', '2017-06-02 09:53:19', 1, '2017-629100', 'SPU Administrator'),
(142, 'Back to SPU for making of Purchase Order (PO)', '2017-06-02 09:54:10', 1, '2017-629100', 'SPU Administrator'),
(143, 'Forwarded to budget officer', '2017-06-02 09:54:22', 1, '2017-629100', 'SPU Administrator'),
(144, 'Waiting for delivery', '2017-06-02 10:26:20', 1, '2017-629100', 'SPU Administrator'),
(145, 'Bidding', '2017-06-02 14:54:51', 1, '2017-62144225', 'SPU Administrator'),
(146, 'Forward to BAC for signing', '2017-06-02 14:55:01', 1, '2017-62144225', 'SPU Administrator'),
(147, 'Back to SPU for making of Purchase Order (PO)', '2017-06-02 14:55:10', 1, '2017-62144225', 'SPU Administrator'),
(148, 'Forwarded to budget officer', '2017-06-02 14:55:19', 1, '2017-62144225', 'SPU Administrator'),
(149, 'Bidding', '2017-06-05 10:25:28', 1, '2017-62211155', 'SPU Administrator'),
(150, 'Forward to BAC for signing', '2017-06-05 10:25:40', 1, '2017-62211155', 'SPU Administrator'),
(151, 'Back to SPU for making of Purchase Order (PO)', '2017-06-05 10:25:58', 1, '2017-62211155', 'SPU Administrator'),
(152, 'Forwarded to budget officer', '2017-06-05 10:26:08', 1, '2017-62211155', 'SPU Administrator'),
(153, 'Bidding', '2017-06-05 17:50:28', 1, '2017-65174648', 'SPU Administrator'),
(154, 'Bidding', '2017-06-07 13:27:43', 1, '2017-66115322', 'SPU Administrator'),
(155, 'Forward to BAC for signing', '2017-06-07 13:37:00', 1, '2017-66115322', 'SPU Administrator'),
(156, 'Back to SPU for making of Purchase Order (PO)', '2017-06-07 14:01:17', 1, '2017-66115322', 'SPU Administrator'),
(157, 'Forwarded to budget officer', '2017-06-07 14:06:05', 1, '2017-66115322', 'SPU Administrator');

--
-- Indexes for table `authorized_personnel_logs`
--
ALTER TABLE `authorized_personnel_logs`
  ADD PRIMARY KEY (`log_id`),
  ADD KEY `FK_authorized_personnel_logs_1` (`personnel_id`);

--
-- Indexes for table `director`
--
ALTER TABLE `director`
  ADD PRIMARY KEY (`d_id`),
  ADD KEY `FK_director_1` (`personnel_id`),
  ADD KEY `FK_director_2` (`pr_number`);

--
-- Indexes for table `end_user_logs`
--
ALTER TABLE `end_user_logs`
  ADD PRIMARY KEY (`log_id`),
  ADD KEY `FK_end_user_logs_1` (`user_id`);

--
-- Indexes for table `end_user_notification`
--
ALTER TABLE `end_user_notification`
  ADD PRIMARY KEY (`notification_id`),
  ADD KEY `FK_end_user_notification_1` (`user_id`);

--
-- Indexes for table `end_user_purchase_request`
--
ALTER TABLE `end_user_purchase_request`
  ADD PRIMARY KEY (`pr_id`),
  ADD UNIQUE KEY `Index_3` (`pr_number`) USING HASH,
  ADD KEY `FK_purchase_request_1` (`user_id`),
  ADD KEY `FK_end_user_purchase_request_2` (`head_id`);

--
-- Indexes for table `head_officer_logs`
--
ALTER TABLE `head_officer_logs`
  ADD PRIMARY KEY (`log_id`),
  ADD KEY `FK_head_officer_logs_1` (`head_id`);

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`item_no`),
  ADD KEY `FK_items_1` (`pr_number`) USING BTREE;

--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
  ADD PRIMARY KEY (`message_id`),
  ADD KEY `FK_messages_1` (`user_id`),
  ADD KEY `FK_messages_2` (`spu_id`);

--
-- Indexes for table `office`
--
ALTER TABLE `office`
  ADD PRIMARY KEY (`office_id`);

--
-- Indexes for table `purchase_request_date_submitted`
--
ALTER TABLE `purchase_request_date_submitted`
  ADD PRIMARY KEY (`prds_id`),
  ADD KEY `FK_purchase_request_date_submitted_1` (`pr_number`);

--
-- Indexes for table `purchase_request_track`
--
ALTER TABLE `purchase_request_track`
  ADD PRIMARY KEY (`track_id`),
  ADD KEY `FK_request_logs_1` (`pr_number`) USING BTREE;

--
-- Indexes for table `spu_logs`
--
ALTER TABLE `spu_logs`
  ADD PRIMARY KEY (`log_id`),
  ADD KEY `FK_spu_logs_1` (`spu_id`);

--
-- AUTO_INCREMENT for table `authorized_personnel_logs`
--
ALTER TABLE `authorized_personnel_logs`
  MODIFY `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=290;

--
-- AUTO_INCREMENT for table `director`
--
ALTER TABLE `director`
  MODIFY `d_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `end_user_logs`
--
ALTER TABLE `end_user_logs`
  MODIFY `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `end_user_notification`
--
ALTER TABLE `end_user_notification`
  MODIFY `notification_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `end_user_purchase_request`
--
ALTER TABLE `end_user_purchase_request`
  MODIFY `pr_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `head_officer_logs`
--
ALTER TABLE `head_officer_logs`
  MODIFY `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=94;

--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
  MODIFY `item_no` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `message_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `office`
--
ALTER TABLE `office`
  MODIFY `office_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `purchase_request_date_submitted`
--
ALTER TABLE `purchase_request_date_submitted`
  MODIFY `prds_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `purchase_request_track`
--
ALTER TABLE `purchase_request_track`
  MODIFY `track_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `spu_logs`
--
ALTER TABLE `spu_logs`
  MODIFY `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=158;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `authorized_personnel_logs`
--
ALTER TABLE `authorized_personnel_logs`
  ADD CONSTRAINT `FK_authorized_personnel_logs_1` FOREIGN KEY (`personnel_id`) REFERENCES `authorized_personnel` (`personnel_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `director`
--
ALTER TABLE `director`
  ADD CONSTRAINT `FK_director_1` FOREIGN KEY (`personnel_id`) REFERENCES `authorized_personnel` (`personnel_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `FK_director_2` FOREIGN KEY (`pr_number`) REFERENCES `end_user_purchase_request` (`pr_number`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `end_user_logs`
--
ALTER TABLE `end_user_logs`
  ADD CONSTRAINT `FK_end_user_logs_1` FOREIGN KEY (`user_id`) REFERENCES `end_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `end_user_notification`
--
ALTER TABLE `end_user_notification`
  ADD CONSTRAINT `FK_end_user_notification_1` FOREIGN KEY (`user_id`) REFERENCES `end_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `end_user_purchase_request`
--
ALTER TABLE `end_user_purchase_request`
  ADD CONSTRAINT `FK_end_user_purchase_request_2` FOREIGN KEY (`head_id`) REFERENCES `head_officer` (`head_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `FK_purchase_request_1` FOREIGN KEY (`user_id`) REFERENCES `end_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `head_officer_logs`
--
ALTER TABLE `head_officer_logs`
  ADD CONSTRAINT `FK_head_officer_logs_1` FOREIGN KEY (`head_id`) REFERENCES `head_officer` (`head_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `items`
--
ALTER TABLE `items`
  ADD CONSTRAINT `FK_items_1` FOREIGN KEY (`pr_number`) REFERENCES `end_user_purchase_request` (`pr_number`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
  ADD CONSTRAINT `FK_messages_1` FOREIGN KEY (`user_id`) REFERENCES `end_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `FK_messages_2` FOREIGN KEY (`spu_id`) REFERENCES `spu_in_charge` (`spu_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `purchase_request_date_submitted`
--
ALTER TABLE `purchase_request_date_submitted`
  ADD CONSTRAINT `FK_purchase_request_date_submitted_1` FOREIGN KEY (`pr_number`) REFERENCES `end_user_purchase_request` (`pr_number`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `purchase_request_track`
--
ALTER TABLE `purchase_request_track`
  ADD CONSTRAINT `FK_request_logs_1` FOREIGN KEY (`pr_number`) REFERENCES `end_user_purchase_request` (`pr_number`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `spu_logs`
--
ALTER TABLE `spu_logs`
  ADD CONSTRAINT `FK_spu_logs_1` FOREIGN KEY (`spu_id`) REFERENCES `spu_in_charge` (`spu_id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

