Diagnose pagina: - Master-detail layout (lijst links, formulier rechts) - URL state voor selectie (?selected=uuid of ?selected=new) - Inline CRUD zonder modals of navigatie - Vereenvoudigde header (alleen actieve diagnoses teller) ICD-10 Combobox: - Vervangen cmdk/Command met simpele Popover + buttons (fix selectie bug) - Direct typen in input veld (geen extra klik nodig) - Auto-open dropdown bij focus/typen Database: - Fix FK constraint: conditions.encounter_id -> intakes (was encounters) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
16 lines
693 B
SQL
16 lines
693 B
SQL
-- Migration: Fix conditions.encounter_id foreign key
|
|
-- The encounter_id column references intakes, not encounters
|
|
-- This migration drops the incorrect FK constraint and adds the correct one
|
|
|
|
-- Step 1: Drop the incorrect foreign key constraint
|
|
ALTER TABLE conditions
|
|
DROP CONSTRAINT IF EXISTS conditions_encounter_id_fkey;
|
|
|
|
-- Step 2: Add the correct foreign key constraint to intakes table
|
|
ALTER TABLE conditions
|
|
ADD CONSTRAINT conditions_intake_id_fkey
|
|
FOREIGN KEY (encounter_id) REFERENCES intakes(id) ON DELETE SET NULL;
|
|
|
|
-- Add comment for clarity
|
|
COMMENT ON COLUMN conditions.encounter_id IS 'Reference to intake (despite column name, links to intakes table for historical reasons)';
|