wulf-pulse/migrations/016_add_missing_tickets_fields.sql
root 8405c813a3 feat: add missing Tickets entity fields from Autotask API
Added 10 critical missing fields to Tickets entity:

Database Migration (016):
- billing_code_id: Billing code assignment
- configuration_item_id: Primary asset/CI
- creator_resource_id: Ticket creator
- creator_type: Creator type (resource/contact)
- problem_ticket_id: Link to problem ticket
- rma_status: RMA status tracking
- rma_type: RMA type classification
- service_level_agreement_paused_next_event_hours: SLA pause tracking
- is_assigned_to_comanaged: Co-managed assignment flag
- is_visible_to_comanaged: Co-managed visibility flag

Entity Mapper Updates:
- Added all new fields with correct camelCase mapping
- Ensures all Autotask Tickets API fields are captured

This completes the Tickets entity to match the full Autotask API
specification and should resolve issues with missing ticket data.
2026-01-26 15:26:34 -05:00

28 lines
1 KiB
SQL

-- Add missing fields to tickets table based on Autotask Tickets API
-- Reference: https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TicketsEntity.htm
ALTER TABLE tickets
-- Billing and configuration
ADD COLUMN IF NOT EXISTS billing_code_id BIGINT,
ADD COLUMN IF NOT EXISTS configuration_item_id BIGINT,
-- Creator information
ADD COLUMN IF NOT EXISTS creator_resource_id BIGINT,
ADD COLUMN IF NOT EXISTS creator_type INTEGER,
-- Problem/incident tracking
ADD COLUMN IF NOT EXISTS problem_ticket_id BIGINT,
-- RMA fields
ADD COLUMN IF NOT EXISTS rma_status INTEGER,
ADD COLUMN IF NOT EXISTS rma_type INTEGER,
-- SLA tracking
ADD COLUMN IF NOT EXISTS service_level_agreement_paused_next_event_hours DECIMAL(10,2),
-- Co-managed fields
ADD COLUMN IF NOT EXISTS is_assigned_to_comanaged BOOLEAN DEFAULT false,
ADD COLUMN IF NOT EXISTS is_visible_to_comanaged BOOLEAN DEFAULT false;
-- Add comment to track migration
COMMENT ON TABLE tickets IS 'Added missing Autotask API fields - Migration 016';