wulf-pulse/migrations/009_relax_configuration_items_constraints.sql
root 6eee14f8af Add comprehensive admin features and multi-system integration
- Add admin dashboard with sync controls and data browser
- Implement RMM, Auvik, and Addigy organization mappings
- Add chunked ticket sync with progress tracking
- Implement entity sync service with rate limiting
- Add analytics engine and performance optimizer
- Create data browser for all PSA entities
- Add navigation components and UI improvements
- Implement background processing and sync services
- Add comprehensive documentation and migration scripts
- Update configuration items with multi-system support
- Enhance contact management and purchase history
- Add issue type assignment and LLM analyzer
- Improve error handling and logging utilities
2025-11-19 14:18:16 -05:00

18 lines
683 B
SQL

-- Relax foreign key constraints for configuration_items sync
-- This allows configuration items to be synced even when referenced contacts don't exist
-- Make contact_id constraint deferrable and nullable
ALTER TABLE configuration_items
DROP CONSTRAINT IF EXISTS configuration_items_contact_id_fkey;
-- Add back the constraint as deferrable with ON DELETE SET NULL
ALTER TABLE configuration_items
ADD CONSTRAINT configuration_items_contact_id_fkey
FOREIGN KEY (contact_id)
REFERENCES contacts(id)
ON DELETE SET NULL
DEFERRABLE INITIALLY DEFERRED;
-- Ensure contact_id column is nullable
ALTER TABLE configuration_items
ALTER COLUMN contact_id DROP NOT NULL;