update query
This commit is contained in:
@@ -200,6 +200,87 @@ CREATE TABLE activity_logs (
|
||||
FOREIGN KEY (user_id) REFERENCES users(user_id)
|
||||
);
|
||||
|
||||
-- Master Sampling Methods
|
||||
CREATE TABLE master_sampling_methods (
|
||||
MasterSamplingMethodID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterSamplingMethodCode VARCHAR(20) NOT NULL,
|
||||
MasterSamplingMethodName VARCHAR(100) NOT NULL,
|
||||
MasterSamplingMethodStandardRef VARCHAR(100),
|
||||
MasterSamplingMethodMatrix VARCHAR(50),
|
||||
MasterSamplingMethodDescription TEXT,
|
||||
MasterSamplingMethodEquipment TEXT,
|
||||
MasterSamplingMethodProcedure TEXT,
|
||||
MasterSamplingMethodQCRequirements TEXT,
|
||||
MasterSamplingMethodSamplingPoint TEXT,
|
||||
MasterSamplingMethodPreservation TEXT,
|
||||
MasterSamplingMethodContainerType VARCHAR(100),
|
||||
MasterSamplingMethodMinVolume DECIMAL(10,2),
|
||||
MasterSamplingMethodHoldingTime VARCHAR(50),
|
||||
MasterSamplingMethodInterference TEXT,
|
||||
MasterSamplingMethodLimitation TEXT,
|
||||
MasterSamplingMethodSafetyMeasures TEXT,
|
||||
MasterSamplingMethodFieldParameters TEXT,
|
||||
MasterSamplingMethodSamplingFrequency VARCHAR(100),
|
||||
MasterSamplingMethodWeatherRequirement TEXT,
|
||||
MasterSamplingMethodQualityControl TEXT,
|
||||
MasterSamplingMethodReportingRequirement TEXT,
|
||||
MasterSamplingMethodIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterSamplingMethodCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterSamplingMethodCreatedUserID INT,
|
||||
MasterSamplingMethodUpdatedAt DATETIME,
|
||||
MasterSamplingMethodUpdatedUserID INT,
|
||||
MasterSamplingMethodDeletedAt DATETIME,
|
||||
MasterSamplingMethodDeletedUserID INT
|
||||
);
|
||||
|
||||
-- Master Sampling Method Parameters (Parameter yang bisa diuji dengan metode sampling ini)
|
||||
CREATE TABLE master_sampling_method_parameters (
|
||||
MasterSamplingMethodParameterID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterSamplingMethodID INT,
|
||||
MasterParameterID INT,
|
||||
MasterSamplingMethodParameterIsDefault BOOLEAN DEFAULT FALSE,
|
||||
MasterSamplingMethodParameterIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterSamplingMethodParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterSamplingMethodParameterCreatedUserID INT,
|
||||
MasterSamplingMethodParameterUpdatedAt DATETIME,
|
||||
MasterSamplingMethodParameterUpdatedUserID INT,
|
||||
MasterSamplingMethodParameterDeletedAt DATETIME,
|
||||
MasterSamplingMethodParameterDeletedUserID INT
|
||||
);
|
||||
|
||||
-- Master Sampling Method Equipment (Peralatan yang dibutuhkan untuk metode sampling ini)
|
||||
CREATE TABLE master_sampling_method_equipment (
|
||||
MasterSamplingMethodEquipmentID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterSamplingMethodID INT,
|
||||
MasterEquipmentID INT,
|
||||
MasterSamplingMethodEquipmentQuantity INT,
|
||||
MasterSamplingMethodEquipmentIsRequired BOOLEAN DEFAULT TRUE,
|
||||
MasterSamplingMethodEquipmentNotes TEXT,
|
||||
MasterSamplingMethodEquipmentIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterSamplingMethodEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterSamplingMethodEquipmentCreatedUserID INT,
|
||||
MasterSamplingMethodEquipmentUpdatedAt DATETIME,
|
||||
MasterSamplingMethodEquipmentUpdatedUserID INT,
|
||||
MasterSamplingMethodEquipmentDeletedAt DATETIME,
|
||||
MasterSamplingMethodEquipmentDeletedUserID INT
|
||||
);
|
||||
|
||||
-- Master Sampling Method Competencies (Kompetensi yang dibutuhkan untuk metode sampling ini)
|
||||
CREATE TABLE master_sampling_method_competencies (
|
||||
MasterSamplingMethodCompetencyID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterSamplingMethodID INT,
|
||||
MasterCompetencyID INT,
|
||||
MasterSamplingMethodCompetencyIsRequired BOOLEAN DEFAULT TRUE,
|
||||
MasterSamplingMethodCompetencyNotes TEXT,
|
||||
MasterSamplingMethodCompetencyIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterSamplingMethodCompetencyCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterSamplingMethodCompetencyCreatedUserID INT,
|
||||
MasterSamplingMethodCompetencyUpdatedAt DATETIME,
|
||||
MasterSamplingMethodCompetencyUpdatedUserID INT,
|
||||
MasterSamplingMethodCompetencyDeletedAt DATETIME,
|
||||
MasterSamplingMethodCompetencyDeletedUserID INT
|
||||
);
|
||||
|
||||
-- Insert sample data for testing
|
||||
|
||||
-- Sample Users
|
||||
@@ -322,4 +403,119 @@ INSERT INTO activity_logs (user_id, action, table_name, record_id, details, ip_a
|
||||
(3, 'UPDATE', 'samples', 1, 'Sample received at laboratory', '192.168.1.102'),
|
||||
(3, 'CREATE', 'analysis_results', 1, 'Recorded pH analysis result', '192.168.1.102'),
|
||||
(4, 'UPDATE', 'analysis_results', 1, 'Verified analysis result', '192.168.1.103'),
|
||||
(5, 'CREATE', 'reports', 1, 'Created report LHU-2025-001', '192.168.1.104');
|
||||
(5, 'CREATE', 'reports', 1, 'Created report LHU-2025-001', '192.168.1.104');
|
||||
|
||||
-- Insert contoh data Master Sampling Methods
|
||||
INSERT INTO master_sampling_methods (
|
||||
MasterSamplingMethodID,
|
||||
MasterSamplingMethodCode,
|
||||
MasterSamplingMethodName,
|
||||
MasterSamplingMethodStandardRef,
|
||||
MasterSamplingMethodMatrix,
|
||||
MasterSamplingMethodDescription,
|
||||
MasterSamplingMethodEquipment,
|
||||
MasterSamplingMethodProcedure,
|
||||
MasterSamplingMethodQCRequirements,
|
||||
MasterSamplingMethodSamplingPoint,
|
||||
MasterSamplingMethodPreservation,
|
||||
MasterSamplingMethodContainerType,
|
||||
MasterSamplingMethodMinVolume,
|
||||
MasterSamplingMethodHoldingTime,
|
||||
MasterSamplingMethodSafetyMeasures,
|
||||
MasterSamplingMethodFieldParameters,
|
||||
MasterSamplingMethodCreatedUserID
|
||||
) VALUES
|
||||
(1, 'WW-GRAB', 'Grab Sampling Air Limbah',
|
||||
'SNI 6989.59:2008',
|
||||
'Air Limbah',
|
||||
'Pengambilan sampel sesaat untuk pemantauan kualitas air limbah',
|
||||
'Water sampler, botol sampel, pH meter, termometer',
|
||||
'Bilas alat 3x, sampling pada kedalaman 30cm dari permukaan',
|
||||
'Field duplicate 10%, field blank harian',
|
||||
'Inlet dan outlet IPAL, titik penaatan',
|
||||
'H2SO4 untuk COD/BOD, HNO3 untuk logam',
|
||||
'Polyethylene untuk umum, kaca untuk minyak lemak',
|
||||
2.50,
|
||||
'24 jam pada 4°C',
|
||||
'APD standar: safety shoes, sarung tangan, masker',
|
||||
'pH, suhu, debit',
|
||||
1),
|
||||
|
||||
(2, 'EMI-ISO', 'Isokinetic Sampling Emisi',
|
||||
'SNI 7117.2:2009',
|
||||
'Emisi Udara',
|
||||
'Pengambilan sampel isokinetik pada cerobong industri',
|
||||
'Isokinetic sampling kit, filter holder, pitot tube',
|
||||
'Tentukan titik grid, sampling minimal 1 jam per titik',
|
||||
'Leak check pre/post sampling, blanko filter',
|
||||
'Minimal 8 titik pada 2 diameter berbeda',
|
||||
'Tidak ada',
|
||||
'Filter fiber glass',
|
||||
0.00,
|
||||
'Analisis dalam 48 jam',
|
||||
'Full APD: safety shoes, helm, masker full face',
|
||||
'Temperatur, tekanan, kecepatan',
|
||||
1);
|
||||
|
||||
-- 2. Master Sampling Method Parameters
|
||||
INSERT INTO master_sampling_method_parameters (
|
||||
MasterSamplingMethodParameterID,
|
||||
MasterSamplingMethodID,
|
||||
MasterParameterID,
|
||||
MasterSamplingMethodParameterIsDefault,
|
||||
MasterSamplingMethodParameterCreatedUserID
|
||||
) VALUES
|
||||
-- Untuk Air Limbah (WW-GRAB)
|
||||
(1, 1, 1, TRUE, 1), -- pH
|
||||
(2, 1, 2, TRUE, 1), -- BOD
|
||||
(3, 1, 3, TRUE, 1), -- COD
|
||||
(4, 1, 4, TRUE, 1), -- TSS
|
||||
(5, 1, 5, FALSE, 1), -- Minyak & Lemak
|
||||
|
||||
-- Untuk Emisi (EMI-ISO)
|
||||
(6, 2, 10, TRUE, 1), -- Partikulat
|
||||
(7, 2, 11, TRUE, 1), -- SO2
|
||||
(8, 2, 12, TRUE, 1), -- NOx
|
||||
(9, 2, 13, FALSE, 1); -- CO
|
||||
|
||||
-- 3. Master Sampling Method Equipment
|
||||
INSERT INTO master_sampling_method_equipment (
|
||||
MasterSamplingMethodEquipmentID,
|
||||
MasterSamplingMethodID,
|
||||
MasterEquipmentID,
|
||||
MasterSamplingMethodEquipmentQuantity,
|
||||
MasterSamplingMethodEquipmentIsRequired,
|
||||
MasterSamplingMethodEquipmentNotes,
|
||||
MasterSamplingMethodEquipmentCreatedUserID
|
||||
) VALUES
|
||||
-- Untuk Air Limbah (WW-GRAB)
|
||||
(1, 1, 1, 1, TRUE, 'Water sampler volume 1L', 1),
|
||||
(2, 1, 2, 2, TRUE, 'Botol PE 2L', 1),
|
||||
(3, 1, 3, 1, TRUE, 'pH meter portable', 1),
|
||||
(4, 1, 4, 1, TRUE, 'Termometer', 1),
|
||||
(5, 1, 5, 1, FALSE, 'Cool box', 1),
|
||||
|
||||
-- Untuk Emisi (EMI-ISO)
|
||||
(6, 2, 10, 1, TRUE, 'Isokinetic sampling kit', 1),
|
||||
(7, 2, 11, 1, TRUE, 'Filter holder diameter 47mm', 1),
|
||||
(8, 2, 12, 1, TRUE, 'Pitot tube tipe S', 1),
|
||||
(9, 2, 13, 1, FALSE, 'Termometer cerobong', 1);
|
||||
|
||||
-- 4. Master Sampling Method Competencies
|
||||
INSERT INTO master_sampling_method_competencies (
|
||||
MasterSamplingMethodCompetencyID,
|
||||
MasterSamplingMethodID,
|
||||
MasterCompetencyID,
|
||||
MasterSamplingMethodCompetencyIsRequired,
|
||||
MasterSamplingMethodCompetencyNotes,
|
||||
MasterSamplingMethodCompetencyCreatedUserID
|
||||
) VALUES
|
||||
-- Untuk Air Limbah (WW-GRAB)
|
||||
(1, 1, 1, TRUE, 'Sertifikat sampling air limbah', 1),
|
||||
(2, 1, 2, TRUE, 'Pelatihan K3 dasar', 1),
|
||||
(3, 1, 3, FALSE, 'Pelatihan analisis lapangan', 1),
|
||||
|
||||
-- Untuk Emisi (EMI-ISO)
|
||||
(4, 2, 4, TRUE, 'Sertifikat sampling emisi', 1),
|
||||
(5, 2, 5, TRUE, 'Sertifikat bekerja di ketinggian', 1),
|
||||
(6, 2, 6, TRUE, 'Pelatihan K3 lanjutan', 1);
|
||||
Reference in New Issue
Block a user