Files
triqura-ecd/scripts/apply-organization-seed.sh
ikbenlit 2a67a0a2d9 git commit -m "feat(swift): implement Epic 3 - P1 Blocks (E3.S0-S6)" -m "Epic 3 compleet: Alle P1 blocks geïmplementeerd met volledige functionaliteit." -m "E3.S0 - CanvasArea block rendering" -m "- Switch/case voor block types met prefill data" -m "- AnimatePresence voor smooth transitions" -m "- PatientContextCard auto-display wanneer activePatient is gezet" -m "" -m "E3.S1 - Block Container animaties" -m "- Framer Motion animaties voor container, content en close button" -m "- Stagger effecten voor content children" -m "- Hover/tap animaties voor close button" -m "" -m "E3.S2 - DagnotatieBlock" -m "- Patient search met debounced FHIR API integratie" -m "- Category selector (medicatie, adl, gedrag, incident, observatie)" -m "- Textarea met character counter (max 500)" -m "- Opslaan naar /api/reports met validatie en error handling" -m "" -m "E3.S3 - Patient search API" -m "- GET /api/patients/search?q= met fuzzy search" -m "- Match score berekening voor resultaten" -m "- Auth check en error handling" -m "" -m "E3.S4 - ZoekenBlock" -m "- Debounced patient search met dropdown" -m "- Patient selectie → setActivePatient in store" -m "- Auto-close na selectie + recent action" -m "" -m "E3.S5 - PatientContextCard" -m "- Auto-open na patient selectie" -m "- Notities, vitals, diagnoses en risico's secties" -m "- API integratie met /api/overdracht/[patientId]" -m "" -m "E3.S6 - OverdrachtBlock" -m "- Lijst van patiënten met activiteit" -m "- Period selector (1d, 3d, 7d, 14d)" -m "- AI samenvatting generatie per patiënt" -m "- Aandachtspunten en actiepunten weergave" -m "" -m "Technische verbeteringen:" -m "- Technische debt opgelost: BlockContainer animaties, CanvasArea rendering" -m "- PatientContextCard toegevoegd aan blocks" -m "- Alle blocks gebruiken BlockContainer voor consistente styling" -m "" -m "Voortgang: 56 SP / 72 SP (78%) - Epic 3 compleet"
2025-12-24 09:06:39 +01:00

77 lines
2.6 KiB
Bash

#!/bin/bash
# ============================================================================
# Apply Organization Seed Migration
# ============================================================================
# Epic: E3.S1 - Organization seed
# Purpose: Create default organization for development
# ============================================================================
set -e
echo "🚀 Applying organization seed migration..."
echo ""
# Load environment variables
if [ -f .env.local ]; then
export $(cat .env.local | grep -v '^#' | grep -v '^$' | xargs)
fi
# Check if Supabase is available
echo "Checking Supabase connection..."
curl -s -o /dev/null -w "%{http_code}" "${NEXT_PUBLIC_SUPABASE_URL}/rest/v1/" -H "apikey: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}" | grep -q "200" || {
echo "❌ Cannot connect to Supabase. Please check if:"
echo " - Supabase is online (not under maintenance)"
echo " - Environment variables are set correctly"
exit 1
}
echo "✅ Supabase is reachable"
echo ""
# Apply migration using psql
MIGRATION_FILE="supabase/migrations/20251122_seed_default_organization.sql"
if [ ! -f "$MIGRATION_FILE" ]; then
echo "❌ Migration file not found: $MIGRATION_FILE"
exit 1
fi
echo "📄 Applying migration: $MIGRATION_FILE"
echo ""
# Get database connection string from Supabase dashboard
# Format: postgresql://postgres:[PASSWORD]@db.dqugbrpwtisgyxscpefg.supabase.co:5432/postgres
# You can find this in: Supabase Dashboard > Project Settings > Database > Connection string
echo "⚠️ To apply this migration, run the SQL file in Supabase SQL Editor:"
echo ""
echo " 1. Go to https://supabase.com/dashboard/project/dqugbrpwtisgyxscpefg/sql"
echo " 2. Copy and paste the contents of:"
echo " $MIGRATION_FILE"
echo " 3. Click 'Run'"
echo ""
echo "Or use the Supabase CLI:"
echo " npx supabase db push"
echo ""
echo "Or use psql (if you have database password):"
echo " psql 'postgresql://postgres:[PASSWORD]@db.dqugbrpwtisgyxscpefg.supabase.co:5432/postgres' -f $MIGRATION_FILE"
echo ""
# Alternative: Use Supabase Management API to apply migration
# This requires the service role key
# Uncomment if you want to use this method:
#
# echo "Applying migration via Supabase Management API..."
#
# MIGRATION_SQL=$(cat "$MIGRATION_FILE")
#
# curl -X POST \
# "${NEXT_PUBLIC_SUPABASE_URL}/rest/v1/rpc/exec" \
# -H "apikey: ${SUPABASE_SERVICE_ROLE_KEY}" \
# -H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}" \
# -H "Content-Type: application/json" \
# -d "{\"query\": $(jq -Rs . <<< "$MIGRATION_SQL")}"
echo "✅ Script completed. Please apply the migration manually as described above."