-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Oct 04, 2025 at 08:56 AM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `niph_dsps`
--

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

--
-- Table structure for table `dsps_tbl_announcement`
--

CREATE TABLE `dsps_tbl_announcement` (
  `pkdspsann_id` int(11) NOT NULL,
  `dspsann_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsann_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsann_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `dspsann_title` varchar(255) NOT NULL,
  `dspsann_description` text NOT NULL,
  `dspsann_photopath` varchar(255) DEFAULT NULL COMMENT 'Optional image path for announcement',
  `dspsann_status` enum('Published','Draft','Archived') NOT NULL DEFAULT 'Draft'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_announcement`
--

INSERT INTO `dsps_tbl_announcement` (`pkdspsann_id`, `dspsann_reg_datetime`, `dspsann_mod_datetime`, `dspsann_reg_by`, `dspsann_title`, `dspsann_description`, `dspsann_photopath`, `dspsann_status`) VALUES
(1, '2025-07-19 16:31:56', '2025-07-19 16:33:19', 1, 'Important Policy Update for Data Access', 'We have updated our data access policy to streamline the request process. Please review the new guidelines in the \"My Permissions\" section for Data Users and \"Manage Permissions\" for Data Owners.', NULL, 'Published'),
(2, '2025-07-19 16:31:56', '2025-07-19 16:33:23', 1, 'New Research Datasets on Infectious Diseases', 'Exciting new datasets related to recent infectious disease outbreaks are now available for approved researchers. These include anonymized patient data and epidemiological trends.', NULL, 'Published'),
(3, '2025-07-19 16:31:56', '2025-07-19 16:31:56', 1, 'Platform Maintenance Scheduled for July 25th', 'Please be advised that the DSPS will undergo scheduled maintenance on July 25th, 2025, from 10:00 PM to 2:00 AM (ICT). During this period, the platform may be temporarily unavailable.', NULL, 'Published'),
(4, '2025-07-19 16:31:56', '2025-08-11 08:47:22', 1, 'Call for Data Sharing Proposals', 'NIPH is inviting proposals from researchers and institutions interested in sharing their public health datasets through our platform. Visit the \"Data Owner\" section for more details.', '', 'Archived'),
(5, '2025-07-19 16:31:56', '2025-08-11 08:47:15', 1, 'Draft Announcement - Internal Review', 'This is a draft announcement for internal review only. It is not visible to the public.', '', 'Archived');

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

--
-- Table structure for table `dsps_tbl_anonymous`
--

CREATE TABLE `dsps_tbl_anonymous` (
  `pkdspsano_id` int(11) NOT NULL,
  `dspsano_reg_datetime` datetime DEFAULT current_timestamp(),
  `fkdspsds_id` int(11) NOT NULL COMMENT 'FK to dsps_tbl_datasource',
  `dspsano_client_ip` varchar(45) DEFAULT NULL COMMENT 'IPv4 or IPv6 address',
  `dspsano_datetime` datetime DEFAULT current_timestamp(),
  `dspsano_action` varchar(100) DEFAULT NULL COMMENT 'e.g., View Introduction, Clicked Link'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `dsps_tbl_datasource`
--

CREATE TABLE `dsps_tbl_datasource` (
  `pkdspsds_id` int(11) NOT NULL,
  `dspsds_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsds_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsds_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users (who registered this data source)',
  `fkdspstds_id` int(11) NOT NULL COMMENT 'FK to dsps_tbl_typedatasource',
  `fkdspscate_id` int(11) NOT NULL COMMENT 'FK to dsps_tbl_dspscategory',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people (Data Owner of this source)',
  `dspsds_filename` varchar(255) DEFAULT NULL COMMENT 'File path/name for CSV/JSON/PDF, or API endpoint URL',
  `dspsds_title_en` varchar(255) NOT NULL,
  `dspsds_title_kh` varchar(255) DEFAULT NULL,
  `dspsds_description` text DEFAULT NULL,
  `dspsds_public_date` date DEFAULT NULL COMMENT 'Date when data source was made public',
  `dspsds_status` varchar(20) NOT NULL DEFAULT 'Pending Review',
  `dspsds_filename1` varchar(250) DEFAULT NULL,
  `dspsds_filename2` varchar(250) DEFAULT NULL,
  `dspsds_filename3` varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_datasource`
--

INSERT INTO `dsps_tbl_datasource` (`pkdspsds_id`, `dspsds_reg_datetime`, `dspsds_mod_datetime`, `dspsds_reg_by`, `fkdspstds_id`, `fkdspscate_id`, `fkisp_id_of`, `dspsds_filename`, `dspsds_title_en`, `dspsds_title_kh`, `dspsds_description`, `dspsds_public_date`, `dspsds_status`, `dspsds_filename1`, `dspsds_filename2`, `dspsds_filename3`) VALUES
(4, '2025-07-20 12:43:12', '2025-07-20 13:01:06', 2, 1, 3, 2, 'population_health_2023.csv', 'National Population Health Survey 2023', 'ការស្ទង់មតិសុខភាពប្រជាជនជាតិឆ្នាំ២០២៣', 'Comprehensive dataset on health indicators, demographics, and disease prevalence across Cambodia. Data collected in 2023.', NULL, 'Active', '', NULL, ''),
(9, '2025-07-20 12:46:56', '2025-07-26 10:26:42', 2, 1, 1, 2, 'infectious_disease_api_endpoint.json', 'API Endpoint for Infectious Disease Trends', 'ចំណុចបញ្ចប់ API សម្រាប់និន្នាការជំងឺឆ្លង', 'Real-time data access for common infectious diseases, including incidence rates and geographical distribution. Requires API key.', NULL, 'Active', '', NULL, ''),
(10, '2025-08-09 12:36:52', '2025-08-09 12:36:52', 2, 1, 2, 2, 'datasource_6896de743a3f0.csv', 'TEST001', 'test001', 'test', NULL, 'Active', '', NULL, ''),
(11, '2025-08-30 13:55:40', '2025-08-30 13:55:40', 206, 4, 1, 104, 'datasource_68b2a06c7245e.pdf', 'test for Contributor', 'test', 'test for Contributor', NULL, 'Active', '', NULL, ''),
(12, '2025-09-06 15:55:39', '2025-09-06 15:55:39', 2, 1, 2, 2, 'datasource_68bbf70b91bc0.xlsx', 'Test5555', '', 'Test5555', NULL, 'Active', NULL, NULL, NULL);

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

--
-- Table structure for table `dsps_tbl_datasource_permission`
--

CREATE TABLE `dsps_tbl_datasource_permission` (
  `pkdspsdsp_id` int(11) NOT NULL,
  `dspsdsp_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsdsp_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsdsp_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users (who granted permission, usually Data Owner)',
  `fkdspsds_id` int(11) NOT NULL COMMENT 'FK to dsps_tbl_datasource',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people (User who is granted permission)',
  `dspsdsp_datetime` datetime DEFAULT current_timestamp() COMMENT 'When permission was granted/requested',
  `dspsdsp_permission` enum('Read','Download','Analyze') NOT NULL,
  `dspsdsp_notes` text DEFAULT NULL,
  `dspsdsp_proof_path` varchar(255) DEFAULT NULL,
  `dspsdsp_status` enum('Approved','Pending','Rejected','Revoked') NOT NULL DEFAULT 'Pending'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_datasource_permission`
--

INSERT INTO `dsps_tbl_datasource_permission` (`pkdspsdsp_id`, `dspsdsp_reg_datetime`, `dspsdsp_mod_datetime`, `dspsdsp_reg_by`, `fkdspsds_id`, `fkisp_id_of`, `dspsdsp_datetime`, `dspsdsp_permission`, `dspsdsp_notes`, `dspsdsp_proof_path`, `dspsdsp_status`) VALUES
(1, '2025-08-09 11:23:07', '2025-08-09 11:46:06', 2, 9, 3, '2025-08-09 11:23:07', 'Download', '', NULL, 'Approved'),
(4, '2025-08-09 11:39:22', '2025-08-09 11:46:03', 2, 4, 3, '2025-08-09 11:39:22', 'Read', '', NULL, 'Approved'),
(5, '2025-08-09 12:48:09', '2025-08-09 12:48:39', 2, 10, 3, '2025-08-09 12:48:09', 'Download', '', NULL, 'Approved'),
(6, '2025-08-30 14:00:25', '2025-08-30 14:01:09', 206, 11, 105, '2025-08-30 14:00:25', 'Download', '', NULL, 'Approved'),
(7, '2025-08-30 14:26:17', '2025-08-30 14:29:27', 2, 10, 104, '2025-08-30 14:26:17', 'Download', '', NULL, 'Approved');

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

--
-- Table structure for table `dsps_tbl_datasource_used`
--

CREATE TABLE `dsps_tbl_datasource_used` (
  `pkdspsdspused_id` int(11) NOT NULL,
  `dspsdspused_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsdspused_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsdspused_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users (who performed the action)',
  `fkdspsdsused_id` int(11) NOT NULL COMMENT 'FK to dsps_tbl_datasource (the data source that was used)',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people (the user who used it)',
  `dspsdspused_datetime` datetime DEFAULT current_timestamp(),
  `dspsdspused_action` varchar(100) DEFAULT NULL COMMENT 'e.g., Downloaded, Accessed API, Ran Analysis'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_datasource_used`
--

INSERT INTO `dsps_tbl_datasource_used` (`pkdspsdspused_id`, `dspsdspused_reg_datetime`, `dspsdspused_mod_datetime`, `dspsdspused_reg_by`, `fkdspsdsused_id`, `fkisp_id_of`, `dspsdspused_datetime`, `dspsdspused_action`) VALUES
(1, '2025-08-09 13:08:06', '2025-08-09 13:08:06', NULL, 10, 3, '2025-08-09 13:08:06', 'Downloaded'),
(2, '2025-08-09 13:09:06', '2025-08-09 13:09:06', NULL, 9, 3, '2025-08-09 13:09:06', 'Downloaded'),
(3, '2025-08-09 14:34:08', '2025-08-09 14:34:08', NULL, 10, 3, '2025-08-09 14:34:08', 'Downloaded'),
(4, '2025-08-09 14:34:15', '2025-08-09 14:34:15', NULL, 10, 3, '2025-08-09 14:34:15', 'Downloaded'),
(5, '2025-08-30 14:30:39', '2025-08-30 14:30:39', NULL, 10, 104, '2025-08-30 14:30:39', 'Downloaded');

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

--
-- Table structure for table `dsps_tbl_dspsabout`
--

CREATE TABLE `dsps_tbl_dspsabout` (
  `pkdspsabout_id` int(11) NOT NULL,
  `dspsabout_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsabout_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsabout_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people (who created/modified this about entry)',
  `dspsabout_title_en` varchar(255) NOT NULL,
  `dspsabout_description` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_dspsabout`
--

INSERT INTO `dsps_tbl_dspsabout` (`pkdspsabout_id`, `dspsabout_reg_datetime`, `dspsabout_mod_datetime`, `dspsabout_reg_by`, `fkisp_id_of`, `dspsabout_title_en`, `dspsabout_description`) VALUES
(1, '2025-07-19 16:35:41', '2025-07-19 16:35:41', 1, 1, 'Our Vision', 'To be a leading institution in public health, fostering a healthier and more resilient community through evidence-based practices and collaborative data sharing.'),
(2, '2025-07-19 16:35:41', '2025-07-19 16:35:41', 1, 1, 'Our Mission', 'To protect and promote the health of the population through scientific research, education, and effective public health interventions, facilitated by accessible and secure data.'),
(3, '2025-07-19 16:35:41', '2025-07-19 16:35:41', 1, 1, 'Our Goals', '1. Enhance data accessibility for public health research. 2. Promote data-driven decision-making. 3. Strengthen collaboration among health stakeholders. 4. Ensure data security and privacy.'),
(4, '2025-07-19 16:35:41', '2025-07-19 16:35:41', 1, 1, 'About NIPH', 'The National Institute of Public Health (NIPH) is a governmental institution under the Ministry of Health, Cambodia. Established to conduct research, provide training, and offer public health services, NIPH plays a crucial role in improving the health status of the Cambodian population. This data sharing platform is an initiative to further our mission by enabling secure and efficient data exchange.');

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

--
-- Table structure for table `dsps_tbl_dspscategory`
--

CREATE TABLE `dsps_tbl_dspscategory` (
  `pkdspscate_id` int(11) NOT NULL,
  `dspscate_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspscate_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspscate_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `dspscate_title_en` varchar(255) NOT NULL,
  `dspscate_details` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_dspscategory`
--

INSERT INTO `dsps_tbl_dspscategory` (`pkdspscate_id`, `dspscate_reg_datetime`, `dspscate_mod_datetime`, `dspscate_reg_by`, `dspscate_title_en`, `dspscate_details`) VALUES
(1, '2025-07-12 16:54:58', '2025-07-19 14:50:31', NULL, 'Public Health', 'Data related to public health, diseases, and demographics.'),
(2, '2025-07-12 16:54:58', '2025-07-19 14:50:38', NULL, 'Education Statistics', 'Statistical data on schools, students, and educational outcomes.'),
(3, '2025-07-12 16:54:58', '2025-07-19 14:50:41', NULL, 'Environmental Data', 'Data concerning climate, pollution, and natural resources.');

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

--
-- Table structure for table `dsps_tbl_dspsfaq`
--

CREATE TABLE `dsps_tbl_dspsfaq` (
  `pkdspsfaq_id` int(11) NOT NULL,
  `dspsfaq_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsfaq_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsfaq_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people (who created/modified this FAQ)',
  `dspsfaq_title_en` varchar(255) NOT NULL COMMENT 'Question',
  `dspsfaq_description` text NOT NULL COMMENT 'Answer'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_dspsfaq`
--

INSERT INTO `dsps_tbl_dspsfaq` (`pkdspsfaq_id`, `dspsfaq_reg_datetime`, `dspsfaq_mod_datetime`, `dspsfaq_reg_by`, `fkisp_id_of`, `dspsfaq_title_en`, `dspsfaq_description`) VALUES
(1, '2025-07-19 16:38:29', '2025-07-26 22:23:24', 1, 1, 'What is the NIPH Data Sharing Platform?', 'The NIPH Data Sharing Platform (DSP) is a secure online portal designed to facilitate the sharing and access of public health data among authorized researchers, policymakers, and the public. It aims to promote data-driven decision-making and collaborative research.'),
(2, '2025-07-19 16:38:29', '2025-07-19 16:38:29', 1, 1, 'How can I request access to data?', 'Data Users can browse available data sources and submit a formal request for access through the platform. The request will be reviewed by the respective Data Owner, who will approve or deny access based on the data\'s sensitivity and the user\'s justification.'),
(3, '2025-07-19 16:38:29', '2025-07-19 16:38:29', 1, 1, 'What types of data are available?', 'The platform hosts various types of public health data, including but not limited to epidemiological surveillance data, survey results, laboratory data, and research findings. Data formats may include CSV, JSON, PDF, and potentially API access.'),
(4, '2025-07-19 16:38:29', '2025-07-19 16:38:29', 1, 1, 'Is my data secure on this platform?', 'Yes, data security and privacy are paramount. The platform employs robust security measures, including secure authentication, role-based access control, and data encryption. All sensitive data is handled in compliance with national data protection regulations.'),
(5, '2025-07-19 16:38:29', '2025-07-19 16:38:29', 1, 1, 'How can I contribute my data?', 'If you are a Data Owner (e.g., a researcher or institution with relevant public health data), you can register on the platform and use the \"Manage My Data Sources\" section to upload and describe your datasets. All contributions are subject to review by DAC Staff.');

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

--
-- Table structure for table `dsps_tbl_dspsslide`
--

CREATE TABLE `dsps_tbl_dspsslide` (
  `pkdspsslide_id` int(11) NOT NULL,
  `dspsslide_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsslide_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspsslide_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people (who created/modified this slide)',
  `dspsslide_title_en` varchar(255) NOT NULL,
  `dspsslide_description` text DEFAULT NULL,
  `dspsslide_photoname` varchar(255) NOT NULL COMMENT 'File path/name of the slide image'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_dspsslide`
--

INSERT INTO `dsps_tbl_dspsslide` (`pkdspsslide_id`, `dspsslide_reg_datetime`, `dspsslide_mod_datetime`, `dspsslide_reg_by`, `fkisp_id_of`, `dspsslide_title_en`, `dspsslide_description`, `dspsslide_photoname`) VALUES
(1, '2025-07-20 10:24:56', '2025-08-12 10:01:29', 1, 1, 'Welcome to NIPH Data Sharing Platform', 'Your central hub for public health data and collaborative research.', 'slide_689aae8993e8c.jpg'),
(2, '2025-07-20 10:24:56', '2025-07-20 10:29:44', 1, 1, 'Explore Diverse Datasets', 'Access a wide range of epidemiological, clinical, and environmental health data.', 'slide_68f5da6a43a8d.jpg'),
(3, '2025-07-20 10:24:56', '2025-07-20 10:29:46', 1, 1, 'Empowering Data-Driven Decisions', 'Facilitating informed policy-making and public health interventions.', 'slide_68f5da6a43a8a.jpg');

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

--
-- Table structure for table `dsps_tbl_feedback`
--

CREATE TABLE `dsps_tbl_feedback` (
  `pkdspsfb_id` int(11) NOT NULL,
  `dspsfb_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspsfb_res_datetime` datetime DEFAULT NULL COMMENT 'Response datetime',
  `dspsfb_res_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users (who responded)',
  `dspsfb_client_ip` varchar(45) DEFAULT NULL COMMENT 'IP of the feedback submitter',
  `dspsfb_name` varchar(255) NOT NULL,
  `dspsfb_email` varchar(255) DEFAULT NULL,
  `dspsfb_body_text` text NOT NULL,
  `dspsfb_respond_text` text DEFAULT NULL COMMENT 'Response from DAC staff/admin',
  `dspsfb_status` enum('New','In Progress','Resolved','Archived') NOT NULL DEFAULT 'New'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `dsps_tbl_social`
--

CREATE TABLE `dsps_tbl_social` (
  `pkdspssocial_id` int(11) NOT NULL,
  `dspssocial_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspssocial_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspssocial_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `dspssocial_name` varchar(100) NOT NULL COMMENT 'e.g., Facebook, YouTube, Telegram',
  `dspssocial_link` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `dsps_tbl_typedatasource`
--

CREATE TABLE `dsps_tbl_typedatasource` (
  `pkdspstds_id` int(11) NOT NULL,
  `dspstds_reg_datetime` datetime DEFAULT current_timestamp(),
  `dspstds_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dspstds_reg_by` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users',
  `dspstds_name_en` varchar(100) NOT NULL,
  `dspstds_name_kh` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dsps_tbl_typedatasource`
--

INSERT INTO `dsps_tbl_typedatasource` (`pkdspstds_id`, `dspstds_reg_datetime`, `dspstds_mod_datetime`, `dspstds_reg_by`, `dspstds_name_en`, `dspstds_name_kh`) VALUES
(1, '2025-07-12 16:54:58', '2025-07-12 16:54:58', NULL, 'CSV', 'ស៊ីអេសវី'),
(2, '2025-07-12 16:54:58', '2025-07-12 16:54:58', NULL, 'JSON', 'ជេសអិន'),
(3, '2025-07-12 16:54:58', '2025-07-12 16:54:58', NULL, 'API', 'អេភីអាយ'),
(4, '2025-07-12 16:54:58', '2025-07-12 16:54:58', NULL, 'PDF', 'ភីឌីអេហ្វ');

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

--
-- Table structure for table `ist_tbl_people`
--

CREATE TABLE `ist_tbl_people` (
  `pkisp_id` int(11) NOT NULL,
  `isp_reg_datetime` datetime DEFAULT current_timestamp(),
  `isp_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `isp_regby_id` int(11) DEFAULT NULL COMMENT 'FK to ist_tbl_users if registered by another user, or NULL if self-registered',
  `isp_idcard` varchar(50) DEFAULT NULL,
  `isp_firstname_en` varchar(100) NOT NULL,
  `isp_lastname_en` varchar(100) NOT NULL,
  `isp_sex` enum('Male','Female','Other') NOT NULL,
  `isp_dob` date NOT NULL,
  `isp_pob` varchar(255) DEFAULT NULL COMMENT 'Place of Birth',
  `isp_nationality` varchar(100) DEFAULT 'Cambodian',
  `isp_marital_status` enum('Single','Married','Divorced','Widowed') DEFAULT 'Single',
  `isp_phone_number` varchar(20) DEFAULT NULL,
  `isp_email` varchar(255) DEFAULT NULL,
  `isp_telegram` varchar(255) DEFAULT NULL,
  `isp_note` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ist_tbl_people`
--

INSERT INTO `ist_tbl_people` (`pkisp_id`, `isp_reg_datetime`, `isp_mod_datetime`, `isp_regby_id`, `isp_idcard`, `isp_firstname_en`, `isp_lastname_en`, `isp_sex`, `isp_dob`, `isp_pob`, `isp_nationality`, `isp_marital_status`, `isp_phone_number`, `isp_email`, `isp_telegram`, `isp_note`) VALUES
(1, '2025-07-12 16:16:55', '2025-07-12 16:16:55', NULL, '123456789', 'Admin', 'User', 'Male', '1990-01-01', NULL, 'Cambodian', 'Single', '0123456789', 'admin@example.com', NULL, NULL),
(2, '2025-07-12 16:16:55', '2025-07-12 16:16:55', NULL, '987654321', 'Data', 'Owner', 'Female', '1985-05-10', NULL, 'Cambodian', 'Single', '0987654321', 'owner@example.com', NULL, NULL),
(3, '2025-07-12 16:16:55', '2025-07-12 16:16:55', NULL, '112233445', 'Data', 'User', 'Male', '1992-11-20', NULL, 'Cambodian', 'Single', '0112233445', 'user@example.com', NULL, NULL),
(101, '2025-07-20 12:43:02', '2025-07-20 12:43:02', NULL, '1234567890', 'Mock', 'Owner', 'Male', '1980-01-01', NULL, 'Cambodian', 'Single', '111222333', 'mock.owner@example.com', NULL, NULL),
(102, '2025-08-30 08:34:25', '2025-08-30 08:34:25', NULL, '11', '11', '111', 'Male', '2025-08-30', NULL, 'Cambodian', 'Single', '', '', NULL, NULL),
(103, '2025-08-30 08:37:51', '2025-08-30 08:37:51', NULL, 'N001', 'Pisey', 'Um', 'Female', '2025-08-22', NULL, 'Cambodian', 'Single', '012', 'pisey@gmail.com', NULL, NULL),
(104, '2025-08-30 09:07:13', '2025-08-30 09:07:13', NULL, 'N002', 'sp', 'ch', 'Male', '2025-08-30', NULL, 'Cambodian', 'Single', '092', 'sp@gmail.com', NULL, NULL),
(105, '2025-08-30 10:46:55', '2025-08-30 10:46:55', NULL, 'p001', 'pp', 'ppp', 'Male', '2025-08-30', NULL, 'Cambodian', 'Single', '123', 'pp@gmail.com', NULL, NULL);

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

--
-- Table structure for table `ist_tbl_users`
--

CREATE TABLE `ist_tbl_users` (
  `pkisu_id` int(11) NOT NULL,
  `isu_reg_datetime` datetime DEFAULT current_timestamp(),
  `isu_mod_datetime` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `isu_regby_id` int(11) DEFAULT NULL COMMENT 'FK to pkisu_id if registered by another user, or NULL if self-registered',
  `fkisp_id_of` int(11) NOT NULL COMMENT 'FK to ist_tbl_people',
  `isu_name` varchar(100) NOT NULL COMMENT 'Username',
  `isu_password` varchar(255) NOT NULL COMMENT 'Hashed password',
  `isu_status` enum('DAC Staff','Data Contributor','Data Owner','Data User','Inactive') NOT NULL DEFAULT 'Data User',
  `isu_can_run_r` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 if user may run R/Jupyter integrations'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ist_tbl_users`
--

INSERT INTO `ist_tbl_users` (`pkisu_id`, `isu_reg_datetime`, `isu_mod_datetime`, `isu_regby_id`, `fkisp_id_of`, `isu_name`, `isu_password`, `isu_status`, `isu_can_run_r`) VALUES
(1, '2025-07-12 16:16:55', '2025-07-20 10:48:49', 1, 1, 'admin', '$2y$10$2h/CFUM6D8d0nFSOgUQebOL/ow5pyTAsDRcqZAv0XrkAmyhVs2fIe', 'DAC Staff', 1),
(2, '2025-07-12 16:16:55', '2025-07-20 12:05:18', 1, 2, 'owner', '$2y$10$2h/CFUM6D8d0nFSOgUQebOL/ow5pyTAsDRcqZAv0XrkAmyhVs2fIe', 'Data Owner', 1),
(3, '2025-07-12 16:16:55', '2025-08-11 08:41:57', 1, 3, 'user', '$2y$10$2h/CFUM6D8d0nFSOgUQebOL/ow5pyTAsDRcqZAv0XrkAmyhVs2fIe', 'Data User', 0),
(203, '2025-07-12 16:16:55', '2025-08-11 08:41:57', 3, 101, 'mockup', '$2y$10$2h/CFUM6D8d0nFSOgUQebOL/ow5pyTAsDRcqZAv0XrkAmyhVs2fIe', 'Data User', 0),
(204, '2025-08-30 08:34:25', '2025-08-30 08:34:25', NULL, 102, 'ttt', '$2y$10$aOBNcCE9b1Jh.c.g7tP5gOSoD6RKujzPVV3AMGJH02jm.Uom0.GxS', 'Data User', 0),
(205, '2025-08-30 08:37:51', '2025-08-30 09:10:33', 1, 103, 'pisey', '$2y$10$DYdxGJLZ3XFJWZI.Tcq2IO18DOhXw2KBwnzAXZ3SD8zD0Bw/vtyOO', 'Data Owner', 1),
(206, '2025-08-30 09:07:14', '2025-08-30 10:37:43', NULL, 104, 'sp', '$2y$10$yy9L1fK5Il2e3sSw03pyTukxGRRxU5bxc4Zp09fSZ4GvfhkdcZy4W', 'Data Contributor', 0),
(207, '2025-08-30 10:46:56', '2025-08-30 10:46:56', NULL, 105, 'pp', '$2y$10$JBTBNdWoifyQ3kodJjJfc.c8CQlbVNKVvfJ.lSKiBcVU5W8PkyVom', 'Data User', 0);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `dsps_tbl_announcement`
--
ALTER TABLE `dsps_tbl_announcement`
  ADD PRIMARY KEY (`pkdspsann_id`),
  ADD KEY `dspsann_reg_by` (`dspsann_reg_by`),
  ADD KEY `idx_dspsann_status` (`dspsann_status`);

--
-- Indexes for table `dsps_tbl_anonymous`
--
ALTER TABLE `dsps_tbl_anonymous`
  ADD PRIMARY KEY (`pkdspsano_id`),
  ADD KEY `fkdspsds_id` (`fkdspsds_id`);

--
-- Indexes for table `dsps_tbl_datasource`
--
ALTER TABLE `dsps_tbl_datasource`
  ADD PRIMARY KEY (`pkdspsds_id`),
  ADD KEY `dspsds_reg_by` (`dspsds_reg_by`),
  ADD KEY `fkdspstds_id` (`fkdspstds_id`),
  ADD KEY `fkdspscate_id` (`fkdspscate_id`),
  ADD KEY `fkisp_id_of` (`fkisp_id_of`),
  ADD KEY `idx_dspsds_status` (`dspsds_status`);

--
-- Indexes for table `dsps_tbl_datasource_permission`
--
ALTER TABLE `dsps_tbl_datasource_permission`
  ADD PRIMARY KEY (`pkdspsdsp_id`),
  ADD UNIQUE KEY `fkdspsds_id` (`fkdspsds_id`,`fkisp_id_of`),
  ADD KEY `dspsdsp_reg_by` (`dspsdsp_reg_by`),
  ADD KEY `fkisp_id_of` (`fkisp_id_of`),
  ADD KEY `idx_dspsdsp_status` (`dspsdsp_status`);

--
-- Indexes for table `dsps_tbl_datasource_used`
--
ALTER TABLE `dsps_tbl_datasource_used`
  ADD PRIMARY KEY (`pkdspsdspused_id`),
  ADD KEY `dspsdspused_reg_by` (`dspsdspused_reg_by`),
  ADD KEY `fkdspsdsused_id` (`fkdspsdsused_id`),
  ADD KEY `fkisp_id_of` (`fkisp_id_of`);

--
-- Indexes for table `dsps_tbl_dspsabout`
--
ALTER TABLE `dsps_tbl_dspsabout`
  ADD PRIMARY KEY (`pkdspsabout_id`),
  ADD KEY `fkisp_id_of` (`fkisp_id_of`),
  ADD KEY `dspsabout_reg_by` (`dspsabout_reg_by`),
  ADD KEY `idx_dspsabout_title` (`dspsabout_title_en`);

--
-- Indexes for table `dsps_tbl_dspscategory`
--
ALTER TABLE `dsps_tbl_dspscategory`
  ADD PRIMARY KEY (`pkdspscate_id`),
  ADD UNIQUE KEY `dspscate_title_en` (`dspscate_title_en`),
  ADD KEY `dspscate_reg_by` (`dspscate_reg_by`);

--
-- Indexes for table `dsps_tbl_dspsfaq`
--
ALTER TABLE `dsps_tbl_dspsfaq`
  ADD PRIMARY KEY (`pkdspsfaq_id`),
  ADD KEY `fkisp_id_of` (`fkisp_id_of`),
  ADD KEY `dspsfaq_reg_by` (`dspsfaq_reg_by`);

--
-- Indexes for table `dsps_tbl_dspsslide`
--
ALTER TABLE `dsps_tbl_dspsslide`
  ADD PRIMARY KEY (`pkdspsslide_id`),
  ADD KEY `fkisp_id_of` (`fkisp_id_of`),
  ADD KEY `dspsslide_reg_by` (`dspsslide_reg_by`);

--
-- Indexes for table `dsps_tbl_feedback`
--
ALTER TABLE `dsps_tbl_feedback`
  ADD PRIMARY KEY (`pkdspsfb_id`),
  ADD KEY `dspsfb_res_by` (`dspsfb_res_by`),
  ADD KEY `idx_dspsfb_status` (`dspsfb_status`);

--
-- Indexes for table `dsps_tbl_social`
--
ALTER TABLE `dsps_tbl_social`
  ADD PRIMARY KEY (`pkdspssocial_id`),
  ADD UNIQUE KEY `dspssocial_name` (`dspssocial_name`),
  ADD KEY `dspssocial_reg_by` (`dspssocial_reg_by`);

--
-- Indexes for table `dsps_tbl_typedatasource`
--
ALTER TABLE `dsps_tbl_typedatasource`
  ADD PRIMARY KEY (`pkdspstds_id`),
  ADD UNIQUE KEY `dspstds_name_en` (`dspstds_name_en`),
  ADD UNIQUE KEY `dspstds_name_kh` (`dspstds_name_kh`),
  ADD KEY `dspstds_reg_by` (`dspstds_reg_by`);

--
-- Indexes for table `ist_tbl_people`
--
ALTER TABLE `ist_tbl_people`
  ADD PRIMARY KEY (`pkisp_id`),
  ADD UNIQUE KEY `isp_idcard` (`isp_idcard`),
  ADD UNIQUE KEY `isp_phone_number` (`isp_phone_number`),
  ADD UNIQUE KEY `isp_email` (`isp_email`),
  ADD KEY `idx_isp_idcard` (`isp_idcard`),
  ADD KEY `idx_isp_name` (`isp_firstname_en`,`isp_lastname_en`);

--
-- Indexes for table `ist_tbl_users`
--
ALTER TABLE `ist_tbl_users`
  ADD PRIMARY KEY (`pkisu_id`),
  ADD UNIQUE KEY `fkisp_id_of` (`fkisp_id_of`),
  ADD UNIQUE KEY `isu_name` (`isu_name`),
  ADD KEY `isu_regby_id` (`isu_regby_id`),
  ADD KEY `idx_isu_name` (`isu_name`),
  ADD KEY `idx_isu_status` (`isu_status`);

--
-- Table structure for table `dsp_oauth_clients`
--

DROP TABLE IF EXISTS `dsp_oauth_clients`;
CREATE TABLE `dsp_oauth_clients` (
  `client_id` varchar(128) NOT NULL,
  `client_name` varchar(255) NOT NULL,
  `client_secret_hash` varchar(255) DEFAULT NULL,
  `redirect_uris` text NOT NULL,
  `allowed_scopes` varchar(255) DEFAULT NULL,
  `is_confidential` tinyint(1) NOT NULL DEFAULT 1,
  `is_revoked` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Table structure for table `dsp_oauth_auth_codes`
--

DROP TABLE IF EXISTS `dsp_oauth_auth_codes`;
CREATE TABLE `dsp_oauth_auth_codes` (
  `code_hash` char(64) NOT NULL,
  `client_id` varchar(128) NOT NULL,
  `person_id` int(11) NOT NULL,
  `scope` varchar(255) DEFAULT NULL,
  `redirect_uri` varchar(2000) NOT NULL,
  `expires_at` datetime NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`code_hash`),
  KEY `idx_oauth_auth_client` (`client_id`),
  KEY `idx_oauth_auth_expires` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Table structure for table `dsp_oauth_access_tokens`
--

DROP TABLE IF EXISTS `dsp_oauth_access_tokens`;
CREATE TABLE `dsp_oauth_access_tokens` (
  `token_hash` char(64) NOT NULL,
  `client_id` varchar(128) NOT NULL,
  `person_id` int(11) NOT NULL,
  `scope` varchar(255) DEFAULT NULL,
  `expires_at` datetime NOT NULL,
  `refresh_token_hash` char(64) DEFAULT NULL,
  `refresh_expires_at` datetime DEFAULT NULL,
  `is_revoked` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_used_at` datetime DEFAULT NULL,
  `revoked_at` datetime DEFAULT NULL,
  PRIMARY KEY (`token_hash`),
  KEY `idx_oauth_access_client` (`client_id`),
  KEY `idx_oauth_access_person` (`person_id`),
  KEY `idx_oauth_access_refresh` (`refresh_token_hash`),
  KEY `idx_oauth_access_expires` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `dsps_tbl_announcement`
--
ALTER TABLE `dsps_tbl_announcement`
  MODIFY `pkdspsann_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `dsps_tbl_anonymous`
--
ALTER TABLE `dsps_tbl_anonymous`
  MODIFY `pkdspsano_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `dsps_tbl_datasource`
--
ALTER TABLE `dsps_tbl_datasource`
  MODIFY `pkdspsds_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `dsps_tbl_datasource_permission`
--
ALTER TABLE `dsps_tbl_datasource_permission`
  MODIFY `pkdspsdsp_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `dsps_tbl_datasource_used`
--
ALTER TABLE `dsps_tbl_datasource_used`
  MODIFY `pkdspsdspused_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `dsps_tbl_dspsabout`
--
ALTER TABLE `dsps_tbl_dspsabout`
  MODIFY `pkdspsabout_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `dsps_tbl_dspscategory`
--
ALTER TABLE `dsps_tbl_dspscategory`
  MODIFY `pkdspscate_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `dsps_tbl_dspsfaq`
--
ALTER TABLE `dsps_tbl_dspsfaq`
  MODIFY `pkdspsfaq_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `dsps_tbl_dspsslide`
--
ALTER TABLE `dsps_tbl_dspsslide`
  MODIFY `pkdspsslide_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `dsps_tbl_feedback`
--
ALTER TABLE `dsps_tbl_feedback`
  MODIFY `pkdspsfb_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `dsps_tbl_social`
--
ALTER TABLE `dsps_tbl_social`
  MODIFY `pkdspssocial_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `dsps_tbl_typedatasource`
--
ALTER TABLE `dsps_tbl_typedatasource`
  MODIFY `pkdspstds_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `ist_tbl_people`
--
ALTER TABLE `ist_tbl_people`
  MODIFY `pkisp_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=106;

--
-- AUTO_INCREMENT for table `ist_tbl_users`
--
ALTER TABLE `ist_tbl_users`
  MODIFY `pkisu_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=208;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `dsps_tbl_announcement`
--
ALTER TABLE `dsps_tbl_announcement`
  ADD CONSTRAINT `dsps_tbl_announcement_ibfk_1` FOREIGN KEY (`dspsann_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_anonymous`
--
ALTER TABLE `dsps_tbl_anonymous`
  ADD CONSTRAINT `dsps_tbl_anonymous_ibfk_1` FOREIGN KEY (`fkdspsds_id`) REFERENCES `dsps_tbl_datasource` (`pkdspsds_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_datasource`
--
ALTER TABLE `dsps_tbl_datasource`
  ADD CONSTRAINT `dsps_tbl_datasource_ibfk_1` FOREIGN KEY (`dspsds_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_ibfk_2` FOREIGN KEY (`fkdspstds_id`) REFERENCES `dsps_tbl_typedatasource` (`pkdspstds_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_ibfk_3` FOREIGN KEY (`fkdspscate_id`) REFERENCES `dsps_tbl_dspscategory` (`pkdspscate_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_ibfk_4` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_datasource_permission`
--
ALTER TABLE `dsps_tbl_datasource_permission`
  ADD CONSTRAINT `dsps_tbl_datasource_permission_ibfk_1` FOREIGN KEY (`dspsdsp_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_permission_ibfk_2` FOREIGN KEY (`fkdspsds_id`) REFERENCES `dsps_tbl_datasource` (`pkdspsds_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_permission_ibfk_3` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_datasource_used`
--
ALTER TABLE `dsps_tbl_datasource_used`
  ADD CONSTRAINT `dsps_tbl_datasource_used_ibfk_1` FOREIGN KEY (`dspsdspused_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_used_ibfk_2` FOREIGN KEY (`fkdspsdsused_id`) REFERENCES `dsps_tbl_datasource` (`pkdspsds_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_datasource_used_ibfk_3` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_dspsabout`
--
ALTER TABLE `dsps_tbl_dspsabout`
  ADD CONSTRAINT `dsps_tbl_dspsabout_ibfk_1` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_dspsabout_ibfk_2` FOREIGN KEY (`dspsabout_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_dspscategory`
--
ALTER TABLE `dsps_tbl_dspscategory`
  ADD CONSTRAINT `dsps_tbl_dspscategory_ibfk_1` FOREIGN KEY (`dspscate_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_dspsfaq`
--
ALTER TABLE `dsps_tbl_dspsfaq`
  ADD CONSTRAINT `dsps_tbl_dspsfaq_ibfk_1` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_dspsfaq_ibfk_2` FOREIGN KEY (`dspsfaq_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_dspsslide`
--
ALTER TABLE `dsps_tbl_dspsslide`
  ADD CONSTRAINT `dsps_tbl_dspsslide_ibfk_1` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `dsps_tbl_dspsslide_ibfk_2` FOREIGN KEY (`dspsslide_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_feedback`
--
ALTER TABLE `dsps_tbl_feedback`
  ADD CONSTRAINT `dsps_tbl_feedback_ibfk_1` FOREIGN KEY (`dspsfb_res_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_social`
--
ALTER TABLE `dsps_tbl_social`
  ADD CONSTRAINT `dsps_tbl_social_ibfk_1` FOREIGN KEY (`dspssocial_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsps_tbl_typedatasource`
--
ALTER TABLE `dsps_tbl_typedatasource`
  ADD CONSTRAINT `dsps_tbl_typedatasource_ibfk_1` FOREIGN KEY (`dspstds_reg_by`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `dsp_oauth_auth_codes`
--
ALTER TABLE `dsp_oauth_auth_codes`
  ADD CONSTRAINT `dsp_oauth_auth_codes_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `dsp_oauth_clients` (`client_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dsp_oauth_auth_codes_ibfk_2` FOREIGN KEY (`person_id`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dsp_oauth_access_tokens`
--
ALTER TABLE `dsp_oauth_access_tokens`
  ADD CONSTRAINT `dsp_oauth_access_tokens_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `dsp_oauth_clients` (`client_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dsp_oauth_access_tokens_ibfk_2` FOREIGN KEY (`person_id`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `ist_tbl_users`
--
ALTER TABLE `ist_tbl_users`
  ADD CONSTRAINT `ist_tbl_users_ibfk_1` FOREIGN KEY (`fkisp_id_of`) REFERENCES `ist_tbl_people` (`pkisp_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `ist_tbl_users_ibfk_2` FOREIGN KEY (`isu_regby_id`) REFERENCES `ist_tbl_users` (`pkisu_id`) ON DELETE SET NULL ON UPDATE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
