ganti format table
This commit is contained in:
440
masterdata.txt
440
masterdata.txt
@@ -119,253 +119,265 @@ CREATE TABLE master_sampling_methods (
|
||||
);
|
||||
|
||||
CREATE TABLE master_preservation_methods (
|
||||
preservation_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
preservation_code VARCHAR(20) NOT NULL,
|
||||
preservation_name VARCHAR(100) NOT NULL,
|
||||
chemical_used VARCHAR(100),
|
||||
applicable_parameters TEXT, -- parameter yang menggunakan metode preservasi ini
|
||||
procedure TEXT,
|
||||
storage_condition VARCHAR(100),
|
||||
holding_time VARCHAR(50),
|
||||
safety_precautions TEXT,
|
||||
remarks TEXT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
MasterPreservationMethodID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterPreservationMethodCode VARCHAR(20) NOT NULL,
|
||||
MasterPreservationMethodName VARCHAR(100) NOT NULL,
|
||||
MasterPreservationMethodChemicalUsed VARCHAR(100),
|
||||
MasterPreservationMethodApplicableParameters TEXT,
|
||||
MasterPreservationMethodProcedure TEXT,
|
||||
MasterPreservationMethodStorageCondition VARCHAR(100),
|
||||
MasterPreservationMethodHoldingTime VARCHAR(50),
|
||||
MasterPreservationMethodSafetyPrecautions TEXT,
|
||||
MasterPreservationMethodRemarks TEXT,
|
||||
MasterPreservationMethodIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterPreservationMethodCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterPreservationMethodCreatedUserID INT,
|
||||
MasterPreservationMethodUpdatedAt DATETIME,
|
||||
MasterPreservationMethodUpdatedUserID INT,
|
||||
MasterPreservationMethodDeletedAt DATETIME,
|
||||
MasterPreservationMethodDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE master_sample_containers (
|
||||
container_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
container_code VARCHAR(20) NOT NULL,
|
||||
container_name VARCHAR(100) NOT NULL,
|
||||
material VARCHAR(50), -- HDPE, glass, amber glass, dsb
|
||||
capacity VARCHAR(20), -- misalnya: 250mL, 1L
|
||||
cap_type VARCHAR(50), -- jenis tutup
|
||||
sterilization VARCHAR(50), -- metode sterilisasi jika perlu
|
||||
applicable_parameters TEXT, -- parameter yang menggunakan wadah ini
|
||||
washing_procedure TEXT, -- prosedur pencucian wadah
|
||||
storage_requirements TEXT,
|
||||
remarks TEXT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
MasterSampleContainerID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterSampleContainerCode VARCHAR(20) NOT NULL,
|
||||
MasterSampleContainerName VARCHAR(100) NOT NULL,
|
||||
MasterSampleContainerMaterial VARCHAR(50),
|
||||
MasterSampleContainerCapacity VARCHAR(20),
|
||||
MasterSampleContainerCapType VARCHAR(50),
|
||||
MasterSampleContainerSterilization VARCHAR(50),
|
||||
MasterSampleContainerApplicableParameters TEXT,
|
||||
MasterSampleContainerWashingProcedure TEXT,
|
||||
MasterSampleContainerStorageRequirements TEXT,
|
||||
MasterSampleContainerRemarks TEXT,
|
||||
MasterSampleContainerIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterSampleContainerCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterSampleContainerCreatedUserID INT,
|
||||
MasterSampleContainerUpdatedAt DATETIME,
|
||||
MasterSampleContainerUpdatedUserID INT,
|
||||
MasterSampleContainerDeletedAt DATETIME,
|
||||
MasterSampleContainerDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE master_regulations (
|
||||
regulation_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
regulation_code VARCHAR(20) NOT NULL,
|
||||
regulation_name VARCHAR(200) NOT NULL,
|
||||
issuing_authority VARCHAR(100), -- instansi yang mengeluarkan regulasi
|
||||
regulation_type VARCHAR(50), -- Peraturan Menteri, Peraturan Pemerintah, dsb
|
||||
issue_date DATE,
|
||||
effective_date DATE,
|
||||
applicable_sector VARCHAR(100), -- sektor yang diregulasi
|
||||
scope TEXT,
|
||||
summary TEXT,
|
||||
file_path VARCHAR(255), -- path ke file dokumen regulasi
|
||||
remarks TEXT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
MasterRegulationID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterRegulationCode VARCHAR(20) NOT NULL,
|
||||
MasterRegulationName VARCHAR(200) NOT NULL,
|
||||
MasterRegulationIssuingAuthority VARCHAR(100),
|
||||
MasterRegulationType VARCHAR(50),
|
||||
MasterRegulationIssueDate DATE,
|
||||
MasterRegulationEffectiveDate DATE,
|
||||
MasterRegulationApplicableSector VARCHAR(100),
|
||||
MasterRegulationScope TEXT,
|
||||
MasterRegulationSummary TEXT,
|
||||
MasterRegulationFilePath VARCHAR(255),
|
||||
MasterRegulationRemarks TEXT,
|
||||
MasterRegulationIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterRegulationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterRegulationCreatedUserID INT,
|
||||
MasterRegulationUpdatedAt DATETIME,
|
||||
MasterRegulationUpdatedUserID INT,
|
||||
MasterRegulationDeletedAt DATETIME,
|
||||
MasterRegulationDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE master_quality_standards (
|
||||
standard_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
standard_code VARCHAR(20) NOT NULL,
|
||||
standard_name VARCHAR(200) NOT NULL,
|
||||
regulation_id INT,
|
||||
matrix_type VARCHAR(50), -- air limbah, air sungai, air tanah, dsb
|
||||
industry_type VARCHAR(100), -- tipe industri (jika spesifik)
|
||||
parameter_id INT,
|
||||
min_value DECIMAL(12, 6),
|
||||
max_value DECIMAL(12, 6),
|
||||
unit VARCHAR(20),
|
||||
remarks TEXT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (regulation_id) REFERENCES master_regulations(regulation_id),
|
||||
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id)
|
||||
MasterQualityStandardID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterQualityStandardCode VARCHAR(20) NOT NULL,
|
||||
MasterQualityStandardName VARCHAR(200) NOT NULL,
|
||||
MasterRegulationID INT,
|
||||
MasterQualityStandardMatrixType VARCHAR(50),
|
||||
MasterQualityStandardIndustryType VARCHAR(100),
|
||||
MasterParameterID INT,
|
||||
MasterQualityStandardMinValue DECIMAL(12,6),
|
||||
MasterQualityStandardMaxValue DECIMAL(12,6),
|
||||
MasterQualityStandardUnit VARCHAR(20),
|
||||
MasterQualityStandardRemarks TEXT,
|
||||
MasterQualityStandardIsActive BOOLEAN DEFAULT TRUE,
|
||||
MasterQualityStandardCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MasterQualityStandardCreatedUserID INT,
|
||||
MasterQualityStandardUpdatedAt DATETIME,
|
||||
MasterQualityStandardUpdatedUserID INT,
|
||||
MasterQualityStandardDeletedAt DATETIME,
|
||||
MasterQualityStandardDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE parameter_method_mapping (
|
||||
mapping_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
parameter_id INT,
|
||||
method_id INT,
|
||||
container_id INT,
|
||||
preservation_id INT,
|
||||
is_default BOOLEAN DEFAULT FALSE, -- metode default untuk parameter
|
||||
remarks TEXT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id),
|
||||
FOREIGN KEY (method_id) REFERENCES master_sampling_methods(method_id),
|
||||
FOREIGN KEY (container_id) REFERENCES master_sample_containers(container_id),
|
||||
FOREIGN KEY (preservation_id) REFERENCES master_preservation_methods(preservation_id)
|
||||
ParameterMethodMappingID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
MasterParameterID INT,
|
||||
MasterSamplingMethodID INT,
|
||||
MasterSampleContainerID INT,
|
||||
MasterPreservationMethodID INT,
|
||||
ParameterMethodMappingIsDefault BOOLEAN DEFAULT FALSE,
|
||||
ParameterMethodMappingRemarks TEXT,
|
||||
ParameterMethodMappingIsActive BOOLEAN DEFAULT TRUE,
|
||||
ParameterMethodMappingCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
ParameterMethodMappingCreatedUserID INT,
|
||||
ParameterMethodMappingUpdatedAt DATETIME,
|
||||
ParameterMethodMappingUpdatedUserID INT,
|
||||
ParameterMethodMappingDeletedAt DATETIME,
|
||||
ParameterMethodMappingDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE sampling_plans (
|
||||
plan_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
plan_code VARCHAR(30) NOT NULL,
|
||||
project_name VARCHAR(200) NOT NULL,
|
||||
client_id INT,
|
||||
contact_person_id INT,
|
||||
request_date DATETIME,
|
||||
planned_sampling_date DATE,
|
||||
status VARCHAR(20), -- draft, submitted, approved, completed, cancelled
|
||||
created_by INT,
|
||||
approved_by INT,
|
||||
approval_date DATETIME,
|
||||
total_locations INT,
|
||||
total_parameters INT,
|
||||
remarks TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (client_id) REFERENCES master_clients(client_id),
|
||||
FOREIGN KEY (created_by) REFERENCES master_personnel(personnel_id),
|
||||
FOREIGN KEY (approved_by) REFERENCES master_personnel(personnel_id)
|
||||
SamplingPlanID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
SamplingPlanCode VARCHAR(30) NOT NULL,
|
||||
SamplingPlanProjectName VARCHAR(200) NOT NULL,
|
||||
MasterClientID INT,
|
||||
SamplingPlanContactPersonID INT,
|
||||
SamplingPlanRequestDate DATETIME,
|
||||
SamplingPlanPlannedDate DATE,
|
||||
SamplingPlanStatus VARCHAR(20),
|
||||
SamplingPlanCreatedBy INT,
|
||||
SamplingPlanApprovedBy INT,
|
||||
SamplingPlanApprovalDate DATETIME,
|
||||
SamplingPlanTotalLocations INT,
|
||||
SamplingPlanTotalParameters INT,
|
||||
SamplingPlanRemarks TEXT,
|
||||
SamplingPlanCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
SamplingPlanCreatedUserID INT,
|
||||
SamplingPlanUpdatedAt DATETIME,
|
||||
SamplingPlanUpdatedUserID INT,
|
||||
SamplingPlanDeletedAt DATETIME,
|
||||
SamplingPlanDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE sampling_plan_locations (
|
||||
plan_location_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
plan_id INT,
|
||||
location_id INT,
|
||||
sampling_date DATE,
|
||||
sampling_time TIME,
|
||||
sampling_method_id INT,
|
||||
sampling_personnel_id INT,
|
||||
field_parameters TEXT, -- parameter yang diukur di lapangan
|
||||
special_instructions TEXT,
|
||||
status VARCHAR(20), -- planned, sampled, failed
|
||||
remarks TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id),
|
||||
FOREIGN KEY (location_id) REFERENCES master_sampling_locations(location_id),
|
||||
FOREIGN KEY (sampling_method_id) REFERENCES master_sampling_methods(method_id),
|
||||
FOREIGN KEY (sampling_personnel_id) REFERENCES master_personnel(personnel_id)
|
||||
SamplingPlanLocationID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
SamplingPlanID INT,
|
||||
MasterSamplingLocationID INT,
|
||||
SamplingPlanLocationDate DATE,
|
||||
SamplingPlanLocationTime TIME,
|
||||
MasterSamplingMethodID INT,
|
||||
SamplingPlanLocationPersonnelID INT,
|
||||
SamplingPlanLocationFieldParameters TEXT,
|
||||
SamplingPlanLocationSpecialInstructions TEXT,
|
||||
SamplingPlanLocationStatus VARCHAR(20),
|
||||
SamplingPlanLocationRemarks TEXT,
|
||||
SamplingPlanLocationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
SamplingPlanLocationCreatedUserID INT,
|
||||
SamplingPlanLocationUpdatedAt DATETIME,
|
||||
SamplingPlanLocationUpdatedUserID INT,
|
||||
SamplingPlanLocationDeletedAt DATETIME,
|
||||
SamplingPlanLocationDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE sampling_plan_parameters (
|
||||
plan_parameter_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
plan_id INT,
|
||||
plan_location_id INT,
|
||||
parameter_id INT,
|
||||
container_id INT,
|
||||
preservation_id INT,
|
||||
quantity INT DEFAULT 1,
|
||||
unit_price DECIMAL(12, 2),
|
||||
remarks TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id),
|
||||
FOREIGN KEY (plan_location_id) REFERENCES sampling_plan_locations(plan_location_id),
|
||||
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id),
|
||||
FOREIGN KEY (container_id) REFERENCES master_sample_containers(container_id),
|
||||
FOREIGN KEY (preservation_id) REFERENCES master_preservation_methods(preservation_id)
|
||||
SamplingPlanParameterID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
SamplingPlanID INT,
|
||||
SamplingPlanLocationID INT,
|
||||
MasterParameterID INT,
|
||||
MasterSampleContainerID INT,
|
||||
MasterPreservationMethodID INT,
|
||||
SamplingPlanParameterQuantity INT DEFAULT 1,
|
||||
SamplingPlanParameterUnitPrice DECIMAL(12,2),
|
||||
SamplingPlanParameterRemarks TEXT,
|
||||
SamplingPlanParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
SamplingPlanParameterCreatedUserID INT,
|
||||
SamplingPlanParameterUpdatedAt DATETIME,
|
||||
SamplingPlanParameterUpdatedUserID INT,
|
||||
SamplingPlanParameterDeletedAt DATETIME,
|
||||
SamplingPlanParameterDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE equipment_requisitions (
|
||||
requisition_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
requisition_code VARCHAR(30) NOT NULL,
|
||||
plan_id INT,
|
||||
requisition_date DATETIME,
|
||||
requested_by INT,
|
||||
approved_by INT,
|
||||
approval_date DATETIME,
|
||||
sampling_date DATE,
|
||||
return_date DATE,
|
||||
status VARCHAR(20), -- draft, submitted, approved, issued, returned
|
||||
remarks TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id),
|
||||
FOREIGN KEY (requested_by) REFERENCES master_personnel(personnel_id),
|
||||
FOREIGN KEY (approved_by) REFERENCES master_personnel(personnel_id)
|
||||
EquipmentRequisitionID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
EquipmentRequisitionCode VARCHAR(30) NOT NULL,
|
||||
SamplingPlanID INT,
|
||||
EquipmentRequisitionDate DATETIME,
|
||||
EquipmentRequisitionRequestedBy INT,
|
||||
EquipmentRequisitionApprovedBy INT,
|
||||
EquipmentRequisitionApprovalDate DATETIME,
|
||||
EquipmentRequisitionSamplingDate DATE,
|
||||
EquipmentRequisitionReturnDate DATE,
|
||||
EquipmentRequisitionStatus VARCHAR(20),
|
||||
EquipmentRequisitionRemarks TEXT,
|
||||
EquipmentRequisitionCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
EquipmentRequisitionCreatedUserID INT,
|
||||
EquipmentRequisitionUpdatedAt DATETIME,
|
||||
EquipmentRequisitionUpdatedUserID INT,
|
||||
EquipmentRequisitionDeletedAt DATETIME,
|
||||
EquipmentRequisitionDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE equipment_requisition_items (
|
||||
requisition_item_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
requisition_id INT,
|
||||
equipment_id INT,
|
||||
quantity INT,
|
||||
issued_quantity INT,
|
||||
issued_by INT,
|
||||
issued_date DATETIME,
|
||||
returned_quantity INT,
|
||||
returned_condition VARCHAR(50), -- good, damaged, lost
|
||||
returned_date DATETIME,
|
||||
verified_by INT,
|
||||
remarks TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (requisition_id) REFERENCES equipment_requisitions(requisition_id),
|
||||
FOREIGN KEY (equipment_id) REFERENCES master_equipment(equipment_id),
|
||||
FOREIGN KEY (issued_by) REFERENCES master_personnel(personnel_id),
|
||||
FOREIGN KEY (verified_by) REFERENCES master_personnel(personnel_id)
|
||||
EquipmentRequisitionItemID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
EquipmentRequisitionID INT,
|
||||
MasterEquipmentID INT,
|
||||
EquipmentRequisitionItemQuantity INT,
|
||||
EquipmentRequisitionItemIssuedQuantity INT,
|
||||
EquipmentRequisitionItemIssuedBy INT,
|
||||
EquipmentRequisitionItemIssuedDate DATETIME,
|
||||
EquipmentRequisitionItemReturnedQuantity INT,
|
||||
EquipmentRequisitionItemReturnedCondition VARCHAR(50),
|
||||
EquipmentRequisitionItemReturnedDate DATETIME,
|
||||
EquipmentRequisitionItemVerifiedBy INT,
|
||||
EquipmentRequisitionItemRemarks TEXT,
|
||||
EquipmentRequisitionItemCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
EquipmentRequisitionItemCreatedUserID INT,
|
||||
EquipmentRequisitionItemUpdatedAt DATETIME,
|
||||
EquipmentRequisitionItemUpdatedUserID INT,
|
||||
EquipmentRequisitionItemDeletedAt DATETIME,
|
||||
EquipmentRequisitionItemDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE samples (
|
||||
sample_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
sample_code VARCHAR(50) NOT NULL,
|
||||
plan_id INT,
|
||||
plan_location_id INT,
|
||||
sampling_date DATE,
|
||||
sampling_time TIME,
|
||||
sampler_id INT,
|
||||
preservation_time DATETIME,
|
||||
temperature DECIMAL(5, 2), -- suhu sampel saat pengambilan
|
||||
weather_condition VARCHAR(50),
|
||||
field_ph DECIMAL(5, 2),
|
||||
field_do DECIMAL(5, 2),
|
||||
field_conductivity DECIMAL(10, 2),
|
||||
field_turbidity DECIMAL(10, 2),
|
||||
sample_matrix VARCHAR(50), -- air, tanah, sedimen, dsb
|
||||
sample_source VARCHAR(100),
|
||||
container_id INT,
|
||||
preservation_id INT,
|
||||
received_by INT,
|
||||
received_date DATETIME,
|
||||
received_condition VARCHAR(50), -- good, compromised, rejected
|
||||
storage_location VARCHAR(100),
|
||||
remarks TEXT,
|
||||
status VARCHAR(20), -- collected, in transit, received, in analysis, reported
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id),
|
||||
FOREIGN KEY (plan_location_id) REFERENCES sampling_plan_locations(plan_location_id),
|
||||
FOREIGN KEY (sampler_id) REFERENCES master_personnel(personnel_id),
|
||||
FOREIGN KEY (container_id) REFERENCES master_sample_containers(container_id),
|
||||
FOREIGN KEY (preservation_id) REFERENCES master_preservation_methods(preservation_id),
|
||||
FOREIGN KEY (received_by) REFERENCES master_personnel(personnel_id)
|
||||
SampleID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
SampleCode VARCHAR(50) NOT NULL,
|
||||
SamplingPlanID INT,
|
||||
SamplingPlanLocationID INT,
|
||||
SampleDate DATE,
|
||||
SampleTime TIME,
|
||||
SampleSamplerID INT,
|
||||
SamplePreservationTime DATETIME,
|
||||
SampleTemperature DECIMAL(5,2),
|
||||
SampleWeatherCondition VARCHAR(50),
|
||||
SampleFieldPH DECIMAL(5,2),
|
||||
SampleFieldDO DECIMAL(5,2),
|
||||
SampleFieldConductivity DECIMAL(10,2),
|
||||
SampleFieldTurbidity DECIMAL(10,2),
|
||||
SampleMatrix VARCHAR(50),
|
||||
SampleSource VARCHAR(100),
|
||||
MasterSampleContainerID INT,
|
||||
MasterPreservationMethodID INT,
|
||||
SampleReceivedBy INT,
|
||||
SampleReceivedDate DATETIME,
|
||||
SampleReceivedCondition VARCHAR(50),
|
||||
SampleStorageLocation VARCHAR(100),
|
||||
SampleRemarks TEXT,
|
||||
SampleStatus VARCHAR(20),
|
||||
SampleCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
SampleCreatedUserID INT,
|
||||
SampleUpdatedAt DATETIME,
|
||||
SampleUpdatedUserID INT,
|
||||
SampleDeletedAt DATETIME,
|
||||
SampleDeletedUserID INT
|
||||
);
|
||||
|
||||
CREATE TABLE measurement_results_light (
|
||||
result_id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
sample_id INT,
|
||||
measurement_date DATE,
|
||||
measurement_time TIME,
|
||||
parameter_id INT,
|
||||
measurement_value DECIMAL(10, 2),
|
||||
measurement_unit VARCHAR(20),
|
||||
measurement_point VARCHAR(50),
|
||||
weather_condition VARCHAR(50),
|
||||
light_source VARCHAR(100),
|
||||
ambient_condition VARCHAR(200),
|
||||
standard_id INT,
|
||||
is_compliant BOOLEAN,
|
||||
analyst_id INT,
|
||||
verified_by INT,
|
||||
verification_date DATETIME,
|
||||
remarks TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (sample_id) REFERENCES samples(sample_id),
|
||||
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id),
|
||||
FOREIGN KEY (standard_id) REFERENCES master_quality_standards(standard_id),
|
||||
FOREIGN KEY (analyst_id) REFERENCES master_personnel(personnel_id),
|
||||
FOREIGN KEY (verified_by) REFERENCES master_personnel(personnel_id)
|
||||
MeasurementResultLightID INT PRIMARY KEY AUTO_INCREMENT,
|
||||
SampleID INT,
|
||||
MeasurementResultLightDate DATE,
|
||||
MeasurementResultLightTime TIME,
|
||||
MasterParameterID INT,
|
||||
MeasurementResultLightValue DECIMAL(10,2),
|
||||
MeasurementResultLightUnit VARCHAR(20),
|
||||
MeasurementResultLightPoint VARCHAR(50),
|
||||
MeasurementResultLightWeatherCondition VARCHAR(50),
|
||||
MeasurementResultLightSource VARCHAR(100),
|
||||
MeasurementResultLightAmbientCondition VARCHAR(200),
|
||||
MasterQualityStandardID INT,
|
||||
MeasurementResultLightIsCompliant BOOLEAN,
|
||||
MeasurementResultLightAnalystID INT,
|
||||
MeasurementResultLightVerifiedBy INT,
|
||||
MeasurementResultLightVerificationDate DATETIME,
|
||||
MeasurementResultLightRemarks TEXT,
|
||||
MeasurementResultLightCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
MeasurementResultLightCreatedUserID INT,
|
||||
MeasurementResultLightUpdatedAt DATETIME,
|
||||
MeasurementResultLightUpdatedUserID INT,
|
||||
MeasurementResultLightDeletedAt DATETIME,
|
||||
MeasurementResultLightDeletedUserID INT
|
||||
);
|
||||
|
||||
INSERT INTO master_parameters (parameter_id, parameter_code, parameter_name, parameter_group, standard_method, unit, price, instrumentation, mdl, container_type, preservation, holding_time, remarks, is_active) VALUES
|
||||
|
||||
Reference in New Issue
Block a user