Refactor experiment management and update data structures
- Renamed columns in the experimental run sheet CSV for clarity. - Updated the ExperimentForm component to include new fields for weight per repetition and additional parameters specific to Meyer Cracker experiments. - Enhanced the data entry logic to handle new experiment phases and machine types. - Refactored repetition scheduling logic to use scheduled_date instead of schedule_status for better clarity in status representation. - Improved the user interface for displaying experiment phases and their associated statuses. - Removed outdated seed data and updated database migration scripts to reflect the new schema changes.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- Migration: Require cracking_machine_type_id when has_cracking is true
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Drop existing constraint if it exists (for re-runs)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM pg_constraint c
|
||||
JOIN pg_class t ON c.conrelid = t.oid
|
||||
WHERE t.relname = 'experiment_phases'
|
||||
AND c.conname = 'ck_experiment_phases_machine_required_when_cracking'
|
||||
) THEN
|
||||
ALTER TABLE public.experiment_phases
|
||||
DROP CONSTRAINT ck_experiment_phases_machine_required_when_cracking;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Add check: if has_cracking then cracking_machine_type_id must not be null
|
||||
ALTER TABLE public.experiment_phases
|
||||
ADD CONSTRAINT ck_experiment_phases_machine_required_when_cracking
|
||||
CHECK (
|
||||
(has_cracking = false) OR (cracking_machine_type_id IS NOT NULL)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user