- Commented out all Supabase services to facilitate testing with Supabase CLI. - Updated README to include Supabase directory in project structure. - Adjusted documentation for migration paths in Supabase Docker Compose guide. - Enhanced docker-compose-reset.sh to explicitly remove Supabase volumes and wait for migrations to complete.
47 lines
1.4 KiB
SQL
47 lines
1.4 KiB
SQL
-- Add repetition_id foreign key to cracker parameters tables
|
|
-- This migration adds a foreign key to link cracker parameters to their repetitions
|
|
|
|
-- =============================================
|
|
-- 1. ADD REPETITION_ID TO JC CRACKER PARAMETERS
|
|
-- =============================================
|
|
|
|
ALTER TABLE public.jc_cracker_parameters
|
|
ADD COLUMN IF NOT EXISTS repetition_id UUID REFERENCES public.experiment_repetitions(id) ON DELETE CASCADE;
|
|
|
|
-- Add index for performance
|
|
CREATE INDEX IF NOT EXISTS idx_jc_cracker_parameters_repetition_id
|
|
ON public.jc_cracker_parameters(repetition_id);
|
|
|
|
-- Add unique constraint to ensure one parameter set per repetition
|
|
ALTER TABLE public.jc_cracker_parameters
|
|
ADD CONSTRAINT unique_jc_cracker_parameters_per_repetition
|
|
UNIQUE (repetition_id);
|
|
|
|
-- =============================================
|
|
-- 2. ADD REPETITION_ID TO MEYER CRACKER PARAMETERS
|
|
-- =============================================
|
|
|
|
ALTER TABLE public.meyer_cracker_parameters
|
|
ADD COLUMN IF NOT EXISTS repetition_id UUID REFERENCES public.experiment_repetitions(id) ON DELETE CASCADE;
|
|
|
|
-- Add index for performance
|
|
CREATE INDEX IF NOT EXISTS idx_meyer_cracker_parameters_repetition_id
|
|
ON public.meyer_cracker_parameters(repetition_id);
|
|
|
|
-- Add unique constraint to ensure one parameter set per repetition
|
|
ALTER TABLE public.meyer_cracker_parameters
|
|
ADD CONSTRAINT unique_meyer_cracker_parameters_per_repetition
|
|
UNIQUE (repetition_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|