wulf-pulse/migrations/007_remove_time_entries_foreign_keys.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

16 lines
945 B
SQL

-- Remove all foreign key constraints from time_entries table
-- This allows syncing time entries without requiring related entities to exist first
-- Drop all foreign key constraints
ALTER TABLE time_entries DROP CONSTRAINT IF EXISTS time_entries_resource_id_fkey;
ALTER TABLE time_entries DROP CONSTRAINT IF EXISTS time_entries_ticket_id_fkey;
ALTER TABLE time_entries DROP CONSTRAINT IF EXISTS time_entries_task_id_fkey;
ALTER TABLE time_entries DROP CONSTRAINT IF EXISTS time_entries_project_id_fkey;
ALTER TABLE time_entries DROP CONSTRAINT IF EXISTS time_entries_company_id_fkey;
ALTER TABLE time_entries DROP CONSTRAINT IF EXISTS time_entries_approved_by_resource_id_fkey;
-- Also make resource_id nullable since we're removing constraints
ALTER TABLE time_entries ALTER COLUMN resource_id DROP NOT NULL;
-- Comments
COMMENT ON TABLE time_entries IS 'Autotask time entries - foreign key constraints removed to allow flexible syncing';