wulf-pulse/migrations/015_expand_resources_fields.sql
root 8e0ca0a63b feat: expand Resources entity to include all Autotask API fields
Add comprehensive field support for Resources entity including:
- Name fields: middleInitial, namePrefix, nameSuffix
- Contact: emailAddress2, emailAddress3, homePhone
- Employment: accountingReferenceID, payrollType, internalCost
- System: emailTypeCode, numberFormat, timeFormat, dateFormat
- Demographics: gender
- Security: licenseType, securityLevel
- Location: defaultServiceDeskRoleID

Changes:
- Migration 015: Add new columns to resources table
- Updated entity mapper to map all Autotask Resource fields
- Expanded TypeScript Resource interface with all fields
- Maintains backward compatibility with existing field names

This ensures all data exposed by the Autotask Resources API is
now captured and stored in the database.
2026-01-26 14:28:51 -05:00

37 lines
1.5 KiB
SQL

-- Add comprehensive fields to resources table based on Autotask Resources API
-- Reference: https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/ResourcesEntity.htm
ALTER TABLE resources
-- Name fields
ADD COLUMN IF NOT EXISTS middle_initial VARCHAR(10),
ADD COLUMN IF NOT EXISTS name_prefix VARCHAR(20),
ADD COLUMN IF NOT EXISTS name_suffix VARCHAR(20),
-- Contact information
ADD COLUMN IF NOT EXISTS email_address VARCHAR(255),
ADD COLUMN IF NOT EXISTS email_address2 VARCHAR(255),
ADD COLUMN IF NOT EXISTS email_address3 VARCHAR(255),
ADD COLUMN IF NOT EXISTS home_phone VARCHAR(50),
-- Employment details
ADD COLUMN IF NOT EXISTS accounting_reference_id VARCHAR(100),
ADD COLUMN IF NOT EXISTS payroll_identifier VARCHAR(100),
ADD COLUMN IF NOT EXISTS payroll_type INTEGER,
ADD COLUMN IF NOT EXISTS internal_cost DECIMAL(15,2),
-- Location and availability
ADD COLUMN IF NOT EXISTS default_service_desk_role_id BIGINT,
-- System fields
ADD COLUMN IF NOT EXISTS email_type_code INTEGER,
ADD COLUMN IF NOT EXISTS gender INTEGER,
ADD COLUMN IF NOT EXISTS license_type INTEGER,
ADD COLUMN IF NOT EXISTS number_format VARCHAR(50),
ADD COLUMN IF NOT EXISTS time_format VARCHAR(50),
ADD COLUMN IF NOT EXISTS date_format VARCHAR(50),
-- Security
ADD COLUMN IF NOT EXISTS security_level INTEGER;
-- Add comment to track migration
COMMENT ON TABLE resources IS 'Expanded with all Autotask API fields - Migration 015';