nurse-handover-simulator / remove_strict_fk.sql
LearningnRunning's picture
feat: Add SQL scripts for complete database reset and initialization, including table and function definitions for sessions, chat history, handoff records, and sbar drafts. Implement foreign key constraints and triggers for automatic session management and updated timestamps.
2f230ab
raw
history blame contribute delete
678 Bytes
-- =====================================================
-- κΈ°μ‘΄ ν…Œμ΄λΈ” 및 μ œμ•½μ‘°κ±΄ λͺ¨λ‘ μ‚­μ œ (μƒˆλ‘œ μ‹œμž‘)
-- =====================================================
-- μˆœμ„œλŒ€λ‘œ CASCADE μ‚­μ œ
DROP TABLE IF EXISTS sessions CASCADE;
DROP TABLE IF EXISTS sbar_drafts CASCADE;
DROP TABLE IF EXISTS chat_history CASCADE;
DROP TABLE IF EXISTS handoff_records CASCADE;
DROP TABLE IF EXISTS scenarios CASCADE;
DROP TABLE IF EXISTS patients CASCADE;
-- ν•¨μˆ˜λ„ μ‚­μ œ (λ‚˜μ€‘μ— μž¬μƒμ„±)
DROP FUNCTION IF EXISTS update_updated_at_column() CASCADE;
DROP FUNCTION IF EXISTS update_session_ended_at() CASCADE;
DROP FUNCTION IF EXISTS auto_create_session() CASCADE;