-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 13, 2026 at 01:52 PM
-- Server version: 10.6.22-MariaDB
-- PHP Version: 8.3.23

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: `persadal_lims`
--

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

--
-- Table structure for table `m_method`
--

CREATE TABLE `m_method` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `reference` varchar(255) DEFAULT NULL COMMENT 'SNI reference number',
  `version` varchar(50) DEFAULT NULL,
  `category` enum('KIMIA','FISIKA','MIKROBIOLOGI','BIOLOGI') NOT NULL DEFAULT 'KIMIA',
  `description` text DEFAULT NULL,
  `procedure_summary` text DEFAULT NULL,
  `detection_limit` decimal(20,6) DEFAULT NULL,
  `measurement_unit` varchar(50) DEFAULT NULL,
  `is_accredited` tinyint(1) NOT NULL DEFAULT 0,
  `accreditation_scope` varchar(255) DEFAULT NULL,
  `equipment_required` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`equipment_required`)),
  `reagent_required` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`reagent_required`)),
  `estimated_duration_hours` decimal(5,2) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_method`
--

INSERT INTO `m_method` (`id`, `code`, `name`, `reference`, `version`, `category`, `description`, `procedure_summary`, `detection_limit`, `measurement_unit`, `is_accredited`, `accreditation_scope`, `equipment_required`, `reagent_required`, `estimated_duration_hours`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'SNI-6989-71', 'Uji Air', 'SNI-6989-71:2019', '2019', 'KIMIA', NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 1, 1, 1, NULL, '127.0.0.1', '2026-01-18 04:21:47', '2026-01-18 04:21:47', NULL);

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

--
-- Table structure for table `m_parameter`
--

CREATE TABLE `m_parameter` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `handling_time` int(11) DEFAULT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_parameter`
--

INSERT INTO `m_parameter` (`id`, `category_id`, `handling_time`, `code`, `name`, `description`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, NULL, 'P-001', 'Bau', 'Bau pada sampel air', 1, NULL, 1, NULL, '127.0.0.1', '2026-01-13 14:44:00', '2026-01-15 06:57:30', NULL),
(2, 1, NULL, 'P-002', 'Warna', 'Warna pada sampel air', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL),
(3, 1, NULL, 'P-003', 'Suhu', 'Temperatur sampel', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL),
(4, NULL, NULL, 'P-004', 'pH', 'Derajat keasaman', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL),
(5, NULL, NULL, 'P-005', 'COD', 'Chemical Oxygen Demand', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL);

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

--
-- Table structure for table `m_parameter_accreditation`
--

CREATE TABLE `m_parameter_accreditation` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `parameter_id` bigint(20) UNSIGNED NOT NULL,
  `sample_type_id` bigint(20) UNSIGNED NOT NULL,
  `accreditation_status` enum('ACCREDITED','NOT_ACCREDITED','IN_PROCESS') NOT NULL DEFAULT 'NOT_ACCREDITED',
  `accreditation_scope` varchar(255) DEFAULT NULL,
  `certificate_no` varchar(100) DEFAULT NULL,
  `valid_from` date DEFAULT NULL,
  `valid_until` date DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_parameter_accreditation`
--

INSERT INTO `m_parameter_accreditation` (`id`, `parameter_id`, `sample_type_id`, `accreditation_status`, `accreditation_scope`, `certificate_no`, `valid_from`, `valid_until`, `notes`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'ACCREDITED', 'Lingkup Akreditasi KAN LP-1234-IDN', 'LP-1234-IDN-001', '2025-07-14', '2027-07-14', 'Terakreditasi KAN untuk jenis sampel Air Minum', 1, NULL, NULL, NULL, NULL, '2026-01-13 17:09:11', '2026-01-13 17:09:11', NULL),
(2, 2, 2, 'ACCREDITED', 'Lingkup Akreditasi KAN LP-1234-IDN', 'LP-1234-IDN-002', '2025-07-14', '2027-07-14', 'Terakreditasi KAN untuk jenis sampel Air Limbah', 1, NULL, NULL, NULL, NULL, '2026-01-13 17:09:11', '2026-01-13 17:09:11', NULL),
(3, 3, 3, 'ACCREDITED', 'Lingkup Akreditasi KAN LP-1234-IDN', 'LP-1234-IDN-003', '2025-07-14', '2027-07-14', 'Terakreditasi KAN untuk jenis sampel Air Laut', 1, NULL, NULL, NULL, NULL, '2026-01-13 17:09:11', '2026-01-13 17:09:11', NULL),
(4, 4, 4, 'ACCREDITED', 'Lingkup Akreditasi KAN LP-1234-IDN', 'LP-1234-IDN-004', '2025-07-14', '2027-07-14', 'Terakreditasi KAN untuk jenis sampel Tanah Pertanian', 1, NULL, NULL, NULL, NULL, '2026-01-13 17:09:11', '2026-01-13 17:09:11', NULL),
(5, 5, 5, 'ACCREDITED', 'Lingkup Akreditasi KAN LP-1234-IDN', 'LP-1234-IDN-005', '2025-07-14', '2027-07-14', 'Terakreditasi KAN untuk jenis sampel Sedimen', 1, NULL, NULL, NULL, NULL, '2026-01-13 17:09:11', '2026-01-13 17:09:11', NULL);

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

--
-- Table structure for table `m_parameter_alias`
--

CREATE TABLE `m_parameter_alias` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `parameter_id` bigint(20) UNSIGNED NOT NULL,
  `alias_name` varchar(255) NOT NULL,
  `source` varchar(100) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_parameter_alias`
--

INSERT INTO `m_parameter_alias` (`id`, `parameter_id`, `alias_name`, `source`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Alkalinitas Total', 'SNI 06-6989.11-2004', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:02', '2026-01-13 14:44:02', NULL),
(2, 1, 'Total Alkalinity', 'APHA 2320 B', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:02', '2026-01-13 14:44:02', NULL),
(3, 2, 'COD Cr', 'Internal SOP', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:02', '2026-01-13 14:44:02', NULL),
(4, 1, 'Alkalinitas Total', 'SNI 06-6989.11-2004', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:34', '2026-01-13 14:44:34', NULL),
(5, 1, 'Total Alkalinity', 'APHA 2320 B', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:34', '2026-01-13 14:44:34', NULL),
(6, 2, 'COD Cr', 'Internal SOP', 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:34', '2026-01-13 14:44:34', NULL),
(7, 4, 'derajat keasaman', NULL, 1, 1, 1, NULL, '127.0.0.1', '2026-01-18 14:44:37', '2026-01-18 14:44:59', '2026-01-18 14:44:59'),
(8, 4, 'derajat keasaman', NULL, 1, 1, 1, NULL, '127.0.0.1', '2026-01-18 14:44:59', '2026-01-18 14:44:59', NULL),
(9, 4, 'ph2', NULL, 1, 1, 1, NULL, '127.0.0.1', '2026-01-18 14:44:59', '2026-01-18 14:44:59', NULL);

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

--
-- Table structure for table `m_parameter_category`
--

CREATE TABLE `m_parameter_category` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `icon` varchar(50) DEFAULT NULL,
  `display_order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_parameter_category`
--

INSERT INTO `m_parameter_category` (`id`, `code`, `name`, `description`, `icon`, `display_order`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'FISIKA', 'Fisika', 'Parameter uji yang berkaitan dengan sifat fisik (suhu, pH, warna, bau, dll)', NULL, 1, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-08 18:11:23', '2026-01-15 03:31:15', NULL),
(2, 'KIMIA', 'Kimia', 'Parameter uji yang berkaitan dengan sifat kimia (COD, BOD, logam berat, dll)', NULL, 2, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-08 18:11:23', '2026-01-15 03:31:21', NULL),
(3, 'MIKROBIOLOGI', 'Mikrobiologi', 'Parameter uji yang berkaitan dengan mikroorganisme (bakteri, virus, dll)', NULL, 3, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-08 18:11:23', '2026-01-15 03:31:36', NULL),
(4, 'BIOLOGI', 'Biologi', 'Parameter uji yang berkaitan dengan organisme hidup (plankton, biota, dll)', NULL, 4, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-08 18:11:23', '2026-01-15 03:31:29', NULL),
(5, 'ORGANOLEPTIK', 'Organoleptik', 'Parameter uji yang berkaitan dengan indera (bau, rasa, warna)', NULL, 5, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-08 18:11:23', '2026-01-15 03:30:48', NULL),
(6, 'RADIOAKTIF', 'Radioaktif', 'Parameter uji yang berkaitan dengan radiasi dan radioaktivitas', NULL, 6, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-08 18:11:23', '2026-01-15 03:31:42', NULL),
(7, 'FIS', 'Fisika', 'Parameter fisik seperti bau, rasa, warna, tts, dll', NULL, 0, 1, NULL, 1, 1, '127.0.0.1', '2026-01-13 14:44:31', '2026-01-15 03:29:38', '2026-01-15 03:29:38'),
(8, 'KAN', 'Kimia Anorganik', 'Parameter kimia anorganik seperti logam berat, dll', NULL, 0, 1, NULL, 1, 1, '127.0.0.1', '2026-01-13 14:44:31', '2026-01-15 03:29:43', '2026-01-15 03:29:43'),
(9, 'KOR', 'Kimia Organik', 'Parameter kimia organik seperti fenol, minyak lemak, dll', NULL, 0, 1, NULL, 1, 1, '127.0.0.1', '2026-01-13 14:44:31', '2026-01-15 03:29:48', '2026-01-15 03:29:48'),
(10, 'MIK', 'Mikrobiologi', 'Parameter bakteriologi seperti total coliform, e.coli, dll', NULL, 0, 1, NULL, 1, 1, '127.0.0.1', '2026-01-13 14:44:31', '2026-01-15 03:29:52', '2026-01-15 03:29:52'),
(11, 'RAD', 'Radioaktivitas', 'Parameter radioaktif', NULL, 0, 1, NULL, 1, 1, '127.0.0.1', '2026-01-13 14:44:31', '2026-01-15 03:30:35', '2026-01-15 03:30:35');

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

--
-- Table structure for table `m_parameter_method`
--

CREATE TABLE `m_parameter_method` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `parameter_id` bigint(20) UNSIGNED NOT NULL,
  `method_id` bigint(20) UNSIGNED NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Default method for parameter',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `m_regulation`
--

CREATE TABLE `m_regulation` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `effective_date` date NOT NULL,
  `expiry_date` date DEFAULT NULL,
  `status` varchar(50) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_regulation`
--

INSERT INTO `m_regulation` (`id`, `code`, `name`, `description`, `effective_date`, `expiry_date`, `status`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'PERMENKES-2/2023', 'Permenkes No. 2 Tahun 2023', 'Standar Baku Mutu Kesehatan Lingkungan dan Persyaratan Kesehatan Air', '2023-01-01', '2026-01-30', NULL, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-13 14:44:33', '2026-01-15 07:29:48', NULL),
(2, 'PERMEN-LHK-P.68/2016', 'Permen LHK No. P.68 Tahun 2016', 'Baku Mutu Air Limbah Domestik', '2016-01-01', NULL, NULL, 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:33', '2026-01-13 14:44:33', NULL);

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

--
-- Table structure for table `m_regulation_attachment`
--

CREATE TABLE `m_regulation_attachment` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `regulation_id` bigint(20) UNSIGNED NOT NULL,
  `sample_type_id` bigint(20) UNSIGNED DEFAULT NULL,
  `class_name` varchar(100) DEFAULT NULL,
  `name` varchar(1024) NOT NULL,
  `category` varchar(255) DEFAULT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  `file_type` varchar(100) DEFAULT NULL,
  `file_size` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_regulation_attachment`
--

INSERT INTO `m_regulation_attachment` (`id`, `regulation_id`, `sample_type_id`, `class_name`, `name`, `category`, `file_name`, `file_path`, `file_type`, `file_size`, `description`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, NULL, 'Dokumen Utama', 'Dokumen Utama PERMENKES-2/2023', NULL, 'permenkes-2_2023_full.pdf', 'regulation-attachments/dummy_regulation_file.pdf', 'application/pdf', 512000, 'File dokumen lengkap regulasi Permenkes No. 2 Tahun 2023', 1, 1, 1, NULL, NULL, '2026-01-18 09:10:25', '2026-01-18 09:10:25', NULL),
(2, 1, NULL, 'Lampiran I', 'Lampiran I - Standar Baku Mutu Air Minum', NULL, 'permenkes_2_2023_lampiran_1.pdf', 'regulation-attachments/dummy_lampiran_1.pdf', 'application/pdf', 256000, 'Lampiran I yang berisi standar baku mutu air minum', 1, 1, 1, NULL, NULL, '2026-01-18 09:10:25', '2026-01-18 09:10:25', NULL),
(3, 2, NULL, 'Dokumen Utama', 'Dokumen Utama PERMEN-LHK-P.68/2016', NULL, 'permen-lhk-p_68_2016_full.pdf', 'regulation-attachments/dummy_regulation_file.pdf', 'application/pdf', 512000, 'File dokumen lengkap regulasi Permen LHK No. P.68 Tahun 2016', 1, 1, 1, NULL, NULL, '2026-01-18 09:10:25', '2026-01-18 09:10:25', NULL);

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

--
-- Table structure for table `m_sample_type`
--

CREATE TABLE `m_sample_type` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `storage_requirement` text DEFAULT NULL,
  `handling_instruction` text DEFAULT NULL,
  `handling_time` int(11) DEFAULT NULL,
  `lhu_format_id` bigint(20) UNSIGNED DEFAULT NULL,
  `has_dynamic_fields` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_sample_type`
--

INSERT INTO `m_sample_type` (`id`, `code`, `name`, `description`, `category_id`, `storage_requirement`, `handling_instruction`, `handling_time`, `lhu_format_id`, `has_dynamic_fields`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'ST-AIR-001', 'Air Minum', 'Sampel air minum untuk pengujian kualitas', 1, 'Simpan pada suhu 4°C, maksimal 24 jam', 'Gunakan botol steril, hindari kontaminasi', 2, 1, 0, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-13 06:55:07', '2026-01-18 07:13:37', NULL),
(2, 'ST-AIR-002', 'Air Limbah', 'Sampel air limbah industri', NULL, 'Simpan pada suhu 4°C', 'Gunakan botol plastik atau kaca', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(3, 'ST-AIR-003', 'Air Laut', 'Sampel air laut untuk pengujian parameter lingkungan', NULL, 'Simpan pada suhu 4°C', 'Gunakan botol kaca gelap untuk parameter organik', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(4, 'ST-TNH-001', 'Tanah Pertanian', 'Sampel tanah dari lahan pertanian', NULL, 'Simpan pada suhu ruang, tempat kering', 'Gunakan kantong plastik bersih', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(5, 'ST-TNH-002', 'Sedimen', 'Sampel sedimen dari sungai atau laut', NULL, 'Simpan pada suhu 4°C', 'Gunakan wadah plastik atau kaca', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(6, 'ST-UDR-001', 'Udara Ambient', 'Sampel udara lingkungan', NULL, 'Analisis segera setelah sampling', 'Gunakan impinger atau filter sesuai parameter', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(7, 'ST-UDR-002', 'Udara Emisi', 'Sampel udara emisi cerobong', NULL, 'Analisis segera', 'Gunakan metode isokinetik', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(8, 'ST-PKN-001', 'Makanan', 'Sampel makanan untuk pengujian keamanan pangan', NULL, 'Simpan pada suhu 4°C atau beku sesuai jenis', 'Gunakan wadah steril, hindari kontaminasi', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(9, 'ST-PKN-002', 'Minuman', 'Sampel minuman untuk pengujian kualitas', NULL, 'Simpan pada suhu 4°C', 'Gunakan botol steril', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL),
(10, 'ST-BIO-001', 'Biota Air', 'Sampel ikan, udang, atau biota air lainnya', NULL, 'Simpan beku -20°C', 'Bersihkan dan simpan dalam kantong plastik', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 06:55:07', '2026-01-13 06:55:07', NULL);

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

--
-- Table structure for table `m_sample_type_category`
--

CREATE TABLE `m_sample_type_category` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `icon` varchar(50) DEFAULT NULL,
  `display_order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_sample_type_category`
--

INSERT INTO `m_sample_type_category` (`id`, `code`, `name`, `description`, `icon`, `display_order`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'AIR', 'Air', 'Kategori untuk semua jenis sampel air (minum, limbah, tanah, dll)', '💧', 1, 1, NULL, NULL, NULL, NULL, '2026-01-15 03:59:58', '2026-01-15 03:59:58', NULL),
(2, 'UDARA', 'Udara', 'Kategori untuk sampel udara dan emisi', '🌬️', 2, 1, NULL, NULL, NULL, NULL, '2026-01-15 03:59:58', '2026-01-15 03:59:58', NULL),
(3, 'TANAH', 'Tanah & Sedimen', 'Kategori untuk sampel tanah dan sedimen', '🏔️', 3, 1, NULL, NULL, NULL, NULL, '2026-01-15 03:59:58', '2026-01-15 03:59:58', NULL),
(4, 'BIOTA', 'Biota', 'Kategori untuk sampel biota (ikan, plankton, dll)', '🐟', 4, 1, NULL, NULL, NULL, NULL, '2026-01-15 03:59:58', '2026-01-15 03:59:58', NULL),
(5, 'LIMBAH', 'Limbah B3', 'Kategori untuk sampel limbah bahan berbahaya dan beracun', '☢️', 5, 1, NULL, NULL, NULL, NULL, '2026-01-15 03:59:58', '2026-01-15 03:59:58', NULL),
(6, 'PANGAN', 'Pangan', 'Kategori untuk sampel makanan dan minuman', '🍽️', 6, 1, NULL, NULL, NULL, NULL, '2026-01-15 03:59:58', '2026-01-15 03:59:58', NULL);

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

--
-- Table structure for table `m_sample_type_field`
--

CREATE TABLE `m_sample_type_field` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sample_type_id` bigint(20) UNSIGNED NOT NULL,
  `field_name` varchar(100) NOT NULL,
  `field_key` varchar(50) NOT NULL,
  `field_type` enum('TEXT','NUMBER','DATE','SELECT','TEXTAREA') NOT NULL DEFAULT 'TEXT',
  `field_options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`field_options`)),
  `placeholder` varchar(255) DEFAULT NULL,
  `default_value` varchar(255) DEFAULT NULL,
  `is_required` tinyint(1) NOT NULL DEFAULT 0,
  `display_order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_sample_type_field`
--

INSERT INTO `m_sample_type_field` (`id`, `sample_type_id`, `field_name`, `field_key`, `field_type`, `field_options`, `placeholder`, `default_value`, `is_required`, `display_order`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Nama Pelanggan', 'nama_pelanggan', 'TEXT', '[]', NULL, NULL, 0, 1, 1, 1, 1, NULL, '127.0.0.1', '2026-01-14 10:09:08', '2026-01-14 10:12:18', NULL),
(2, 1, 'Nama Kendaraan', 'nama_kendaraan', 'TEXT', '[]', NULL, NULL, 0, 2, 1, 1, 1, NULL, '127.0.0.1', '2026-01-14 10:12:13', '2026-01-14 10:12:18', NULL);

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

--
-- Table structure for table `m_sample_type_parameter`
--

CREATE TABLE `m_sample_type_parameter` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sample_type_id` bigint(20) UNSIGNED NOT NULL,
  `parameter_id` bigint(20) UNSIGNED NOT NULL,
  `unit` varchar(50) DEFAULT NULL,
  `method_reference` varchar(255) DEFAULT NULL,
  `turnaround_time` int(11) DEFAULT NULL COMMENT 'Waktu pengerjaan dalam hari',
  `method_id` bigint(20) UNSIGNED DEFAULT NULL,
  `subcontract_lab_id` bigint(20) UNSIGNED DEFAULT NULL,
  `analyst_user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `fmmt_template_id` bigint(20) UNSIGNED DEFAULT NULL,
  `test_type` enum('INTERNAL','SUBCONTRACT') NOT NULL DEFAULT 'INTERNAL',
  `sampling_type` enum('FIELD','LAB','BOTH') NOT NULL DEFAULT 'LAB',
  `handling_time` int(11) DEFAULT NULL COMMENT 'Handling time in minutes',
  `is_accredited` tinyint(1) NOT NULL DEFAULT 0,
  `accreditation_scope` varchar(255) DEFAULT NULL,
  `accreditation_valid_until` date DEFAULT NULL,
  `is_required` tinyint(1) NOT NULL DEFAULT 0,
  `display_order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_sample_type_parameter`
--

INSERT INTO `m_sample_type_parameter` (`id`, `sample_type_id`, `parameter_id`, `unit`, `method_reference`, `turnaround_time`, `method_id`, `subcontract_lab_id`, `analyst_user_id`, `fmmt_template_id`, `test_type`, `sampling_type`, `handling_time`, `is_accredited`, `accreditation_scope`, `accreditation_valid_until`, `is_required`, `display_order`, `is_active`, `created_by`, `updated_by`, `deleted_by`, `updated_ip`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, '-', NULL, NULL, NULL, NULL, NULL, NULL, 'INTERNAL', 'LAB', NULL, 0, NULL, NULL, 0, 0, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-13 14:44:00', '2026-01-15 06:57:30', NULL),
(2, 1, 2, 'TCU', NULL, NULL, NULL, NULL, NULL, NULL, 'INTERNAL', 'LAB', NULL, 0, NULL, NULL, 0, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL),
(3, 1, 3, '°C', NULL, NULL, NULL, NULL, NULL, NULL, 'INTERNAL', 'LAB', NULL, 0, NULL, NULL, 0, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL),
(4, 1, 4, '-', NULL, NULL, NULL, NULL, NULL, NULL, 'INTERNAL', 'LAB', NULL, 0, NULL, NULL, 0, 0, 1, NULL, NULL, NULL, NULL, '2026-01-13 14:44:00', '2026-01-13 14:44:00', NULL),
(5, 2, 5, 'mg/L', NULL, NULL, NULL, NULL, 1, NULL, 'INTERNAL', 'LAB', NULL, 0, NULL, NULL, 0, 0, 1, NULL, 1, NULL, '127.0.0.1', '2026-01-13 14:44:00', '2026-01-20 01:52:14', NULL);

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

--
-- Table structure for table `m_sample_type_regulation`
--

CREATE TABLE `m_sample_type_regulation` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sample_type_id` bigint(20) UNSIGNED NOT NULL,
  `regulation_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `m_sample_type_regulation`
--

INSERT INTO `m_sample_type_regulation` (`id`, `sample_type_id`, `regulation_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2026-01-15 04:21:31', '2026-01-15 04:21:31'),
(2, 2, 1, '2026-01-18 08:57:49', '2026-01-18 08:57:49'),
(3, 3, 1, '2026-01-18 08:57:49', '2026-01-18 08:57:49');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `m_method`
--
ALTER TABLE `m_method`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_method_code_unique` (`code`),
  ADD KEY `m_method_code_index` (`code`),
  ADD KEY `m_method_category_index` (`category`),
  ADD KEY `m_method_is_active_index` (`is_active`),
  ADD KEY `m_method_is_accredited_index` (`is_accredited`);

--
-- Indexes for table `m_parameter`
--
ALTER TABLE `m_parameter`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_parameter_code_unique` (`code`),
  ADD KEY `m_parameter_code_index` (`code`),
  ADD KEY `m_parameter_is_active_index` (`is_active`),
  ADD KEY `m_parameter_category_id_index` (`category_id`);

--
-- Indexes for table `m_parameter_accreditation`
--
ALTER TABLE `m_parameter_accreditation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `parameter_accreditation_unique` (`parameter_id`,`sample_type_id`),
  ADD KEY `m_parameter_accreditation_created_by_foreign` (`created_by`),
  ADD KEY `m_parameter_accreditation_updated_by_foreign` (`updated_by`),
  ADD KEY `m_parameter_accreditation_deleted_by_foreign` (`deleted_by`),
  ADD KEY `m_parameter_accreditation_parameter_id_index` (`parameter_id`),
  ADD KEY `m_parameter_accreditation_sample_type_id_index` (`sample_type_id`),
  ADD KEY `m_parameter_accreditation_accreditation_status_index` (`accreditation_status`),
  ADD KEY `m_parameter_accreditation_valid_until_index` (`valid_until`),
  ADD KEY `m_parameter_accreditation_is_active_index` (`is_active`);

--
-- Indexes for table `m_parameter_alias`
--
ALTER TABLE `m_parameter_alias`
  ADD PRIMARY KEY (`id`),
  ADD KEY `m_parameter_alias_created_by_foreign` (`created_by`),
  ADD KEY `m_parameter_alias_updated_by_foreign` (`updated_by`),
  ADD KEY `m_parameter_alias_deleted_by_foreign` (`deleted_by`),
  ADD KEY `m_parameter_alias_parameter_id_index` (`parameter_id`),
  ADD KEY `m_parameter_alias_alias_name_index` (`alias_name`),
  ADD KEY `m_parameter_alias_source_index` (`source`),
  ADD KEY `m_parameter_alias_is_active_index` (`is_active`);

--
-- Indexes for table `m_parameter_category`
--
ALTER TABLE `m_parameter_category`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_parameter_category_code_unique` (`code`),
  ADD KEY `m_parameter_category_created_by_foreign` (`created_by`),
  ADD KEY `m_parameter_category_updated_by_foreign` (`updated_by`),
  ADD KEY `m_parameter_category_deleted_by_foreign` (`deleted_by`),
  ADD KEY `m_parameter_category_code_index` (`code`),
  ADD KEY `m_parameter_category_is_active_index` (`is_active`),
  ADD KEY `m_parameter_category_display_order_index` (`display_order`);

--
-- Indexes for table `m_parameter_method`
--
ALTER TABLE `m_parameter_method`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_parameter_method_parameter_id_method_id_unique` (`parameter_id`,`method_id`),
  ADD KEY `m_parameter_method_method_id_foreign` (`method_id`);

--
-- Indexes for table `m_regulation`
--
ALTER TABLE `m_regulation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_regulation_code_unique` (`code`),
  ADD KEY `m_regulation_code_index` (`code`),
  ADD KEY `m_regulation_is_active_index` (`is_active`),
  ADD KEY `m_regulation_status_index` (`status`);

--
-- Indexes for table `m_regulation_attachment`
--
ALTER TABLE `m_regulation_attachment`
  ADD PRIMARY KEY (`id`),
  ADD KEY `m_regulation_attachment_regulation_id_index` (`regulation_id`),
  ADD KEY `m_regulation_attachment_is_active_index` (`is_active`),
  ADD KEY `m_regulation_attachment_sample_type_id_index` (`sample_type_id`),
  ADD KEY `m_regulation_attachment_class_name_index` (`class_name`);

--
-- Indexes for table `m_sample_type`
--
ALTER TABLE `m_sample_type`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_sample_type_code_unique` (`code`),
  ADD KEY `m_sample_type_code_index` (`code`),
  ADD KEY `m_sample_type_is_active_index` (`is_active`),
  ADD KEY `m_sample_type_category_id_foreign` (`category_id`),
  ADD KEY `m_sample_type_lhu_format_id_foreign` (`lhu_format_id`);

--
-- Indexes for table `m_sample_type_category`
--
ALTER TABLE `m_sample_type_category`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `m_sample_type_category_code_unique` (`code`),
  ADD KEY `m_sample_type_category_code_index` (`code`),
  ADD KEY `m_sample_type_category_is_active_index` (`is_active`),
  ADD KEY `m_sample_type_category_display_order_index` (`display_order`);

--
-- Indexes for table `m_sample_type_field`
--
ALTER TABLE `m_sample_type_field`
  ADD PRIMARY KEY (`id`),
  ADD KEY `m_sample_type_field_created_by_foreign` (`created_by`),
  ADD KEY `m_sample_type_field_updated_by_foreign` (`updated_by`),
  ADD KEY `m_sample_type_field_deleted_by_foreign` (`deleted_by`),
  ADD KEY `m_sample_type_field_sample_type_id_index` (`sample_type_id`),
  ADD KEY `m_sample_type_field_field_key_index` (`field_key`),
  ADD KEY `m_sample_type_field_is_active_index` (`is_active`),
  ADD KEY `m_sample_type_field_display_order_index` (`display_order`);

--
-- Indexes for table `m_sample_type_parameter`
--
ALTER TABLE `m_sample_type_parameter`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sample_type_parameter_unique` (`sample_type_id`,`parameter_id`),
  ADD KEY `m_sample_type_parameter_parameter_id_foreign` (`parameter_id`),
  ADD KEY `m_sample_type_parameter_method_id_index` (`method_id`),
  ADD KEY `m_sample_type_parameter_subcontract_lab_id_index` (`subcontract_lab_id`),
  ADD KEY `m_sample_type_parameter_test_type_index` (`test_type`),
  ADD KEY `m_sample_type_parameter_is_accredited_index` (`is_accredited`),
  ADD KEY `m_sample_type_parameter_is_active_index` (`is_active`),
  ADD KEY `idx_stp_fmmt_template` (`fmmt_template_id`),
  ADD KEY `m_sample_type_parameter_analyst_user_id_index` (`analyst_user_id`);

--
-- Indexes for table `m_sample_type_regulation`
--
ALTER TABLE `m_sample_type_regulation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sample_type_regulation_unique` (`sample_type_id`,`regulation_id`),
  ADD KEY `m_sample_type_regulation_sample_type_id_index` (`sample_type_id`),
  ADD KEY `m_sample_type_regulation_regulation_id_index` (`regulation_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `m_method`
--
ALTER TABLE `m_method`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `m_parameter`
--
ALTER TABLE `m_parameter`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `m_parameter_accreditation`
--
ALTER TABLE `m_parameter_accreditation`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `m_parameter_alias`
--
ALTER TABLE `m_parameter_alias`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `m_parameter_category`
--
ALTER TABLE `m_parameter_category`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `m_parameter_method`
--
ALTER TABLE `m_parameter_method`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `m_regulation`
--
ALTER TABLE `m_regulation`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `m_regulation_attachment`
--
ALTER TABLE `m_regulation_attachment`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `m_sample_type`
--
ALTER TABLE `m_sample_type`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `m_sample_type_category`
--
ALTER TABLE `m_sample_type_category`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `m_sample_type_field`
--
ALTER TABLE `m_sample_type_field`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `m_sample_type_parameter`
--
ALTER TABLE `m_sample_type_parameter`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `m_sample_type_regulation`
--
ALTER TABLE `m_sample_type_regulation`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `m_parameter`
--
ALTER TABLE `m_parameter`
  ADD CONSTRAINT `m_parameter_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `m_parameter_category` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_parameter_accreditation`
--
ALTER TABLE `m_parameter_accreditation`
  ADD CONSTRAINT `m_parameter_accreditation_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_parameter_accreditation_deleted_by_foreign` FOREIGN KEY (`deleted_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_parameter_accreditation_parameter_id_foreign` FOREIGN KEY (`parameter_id`) REFERENCES `m_parameter` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_parameter_accreditation_sample_type_id_foreign` FOREIGN KEY (`sample_type_id`) REFERENCES `m_sample_type` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_parameter_accreditation_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_parameter_alias`
--
ALTER TABLE `m_parameter_alias`
  ADD CONSTRAINT `m_parameter_alias_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_parameter_alias_deleted_by_foreign` FOREIGN KEY (`deleted_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_parameter_alias_parameter_id_foreign` FOREIGN KEY (`parameter_id`) REFERENCES `m_parameter` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_parameter_alias_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_parameter_category`
--
ALTER TABLE `m_parameter_category`
  ADD CONSTRAINT `m_parameter_category_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_parameter_category_deleted_by_foreign` FOREIGN KEY (`deleted_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_parameter_category_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_parameter_method`
--
ALTER TABLE `m_parameter_method`
  ADD CONSTRAINT `m_parameter_method_method_id_foreign` FOREIGN KEY (`method_id`) REFERENCES `m_method` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_parameter_method_parameter_id_foreign` FOREIGN KEY (`parameter_id`) REFERENCES `m_parameter` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `m_regulation_attachment`
--
ALTER TABLE `m_regulation_attachment`
  ADD CONSTRAINT `m_regulation_attachment_regulation_id_foreign` FOREIGN KEY (`regulation_id`) REFERENCES `m_regulation` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_regulation_attachment_sample_type_id_foreign` FOREIGN KEY (`sample_type_id`) REFERENCES `m_sample_type` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_sample_type`
--
ALTER TABLE `m_sample_type`
  ADD CONSTRAINT `m_sample_type_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `m_sample_type_category` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_sample_type_lhu_format_id_foreign` FOREIGN KEY (`lhu_format_id`) REFERENCES `m_lhu_format` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_sample_type_field`
--
ALTER TABLE `m_sample_type_field`
  ADD CONSTRAINT `m_sample_type_field_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_sample_type_field_deleted_by_foreign` FOREIGN KEY (`deleted_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_sample_type_field_sample_type_id_foreign` FOREIGN KEY (`sample_type_id`) REFERENCES `m_sample_type` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_sample_type_field_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `m_user` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_sample_type_parameter`
--
ALTER TABLE `m_sample_type_parameter`
  ADD CONSTRAINT `fk_stp_fmmt_template` FOREIGN KEY (`fmmt_template_id`) REFERENCES `m_fmmt_template` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_sample_type_parameter_analyst_user_id_foreign` FOREIGN KEY (`analyst_user_id`) REFERENCES `m_user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_sample_type_parameter_method_id_foreign` FOREIGN KEY (`method_id`) REFERENCES `m_method` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `m_sample_type_parameter_parameter_id_foreign` FOREIGN KEY (`parameter_id`) REFERENCES `m_parameter` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_sample_type_parameter_sample_type_id_foreign` FOREIGN KEY (`sample_type_id`) REFERENCES `m_sample_type` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_sample_type_parameter_subcontract_lab_id_foreign` FOREIGN KEY (`subcontract_lab_id`) REFERENCES `m_subcontract_lab` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `m_sample_type_regulation`
--
ALTER TABLE `m_sample_type_regulation`
  ADD CONSTRAINT `m_sample_type_regulation_regulation_id_foreign` FOREIGN KEY (`regulation_id`) REFERENCES `m_regulation` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `m_sample_type_regulation_sample_type_id_foreign` FOREIGN KEY (`sample_type_id`) REFERENCES `m_sample_type` (`id`) ON DELETE 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 */;
