Skip to content

Database schema

The package creates five tables with a configurable prefix (default: integration). Publish and run migrations with:

bash
php artisan vendor:publish --tag=integrations-migrations
php artisan migrate

integrations

The main table storing integration records.

ColumnTypeDescription
idbigint (PK)Auto-incrementing ID
providerstringProvider identifier (matches config key)
namestringHuman-readable name
credentialstext (encrypted)Provider credentials, encrypted at rest
metadatajson (nullable)Non-sensitive configuration
owner_typestring (nullable)Polymorphic owner type (for multi-tenancy)
owner_idbigint (nullable)Polymorphic owner ID
is_activebooleanWhether the integration is active
health_statusstringCurrent health: healthy, degraded, failing, disabled
consecutive_failuresintRunning failure counter
last_error_attimestamp (nullable)When the last error occurred
last_synced_attimestamp (nullable)When the last sync completed
next_sync_attimestamp (nullable)When the next sync should run
sync_interval_minutesint (nullable)Override for provider's default interval
sync_cursorjson (nullable)Incremental sync cursor
timestampscreated_at, updated_at

integration_requests

API request/response log. One row per API call (including retries).

ColumnTypeDescription
idbigint (PK)Auto-incrementing ID
integration_idbigint (FK)Parent integration
endpointstringLogical endpoint or URL path
methodstringHTTP method or SDK operation
status_codeint (nullable)HTTP status code
request_datatext (nullable)Request body/params (redacted if applicable)
response_datatext (nullable)Response body (redacted if applicable)
errortext (nullable)Error message on failure
duration_msint (nullable)Request duration in milliseconds
retry_ofbigint (nullable)Points to the original request if this is a retry
related_typestring (nullable)Polymorphic related model type
related_idbigint (nullable)Polymorphic related model ID
cache_hitsintNumber of cache hits for this response
stale_hitsintNumber of stale cache fallbacks
timestampscreated_at, updated_at

integration_logs

Operation-level logs (syncs, imports, webhooks).

ColumnTypeDescription
idbigint (PK)Auto-incrementing ID
integration_idbigint (FK)Parent integration
operationstringOperation type (sync, import, webhook, etc.)
directionstringinbound or outbound
statusstringsuccess or failed
summarystring (nullable)Human-readable summary
external_idstring (nullable)External record ID
metadatajson (nullable)Structured metadata (counts, request IDs, etc.)
duration_msint (nullable)Operation duration
parent_idbigint (nullable)For hierarchical logging
timestampscreated_at, updated_at

integration_mappings

External ID to internal model mapping.

ColumnTypeDescription
idbigint (PK)Auto-incrementing ID
integration_idbigint (FK)Parent integration
external_idstringExternal provider ID
internal_typestringInternal model class
internal_idbigintInternal model ID
timestampscreated_at, updated_at

Unique constraint on (integration_id, external_id, internal_type).

integration_webhooks

Webhook audit trail.

ColumnTypeDescription
idbigint (PK)Auto-incrementing ID
integration_idbigint (FK, nullable)Parent integration (null for generic webhooks)
providerstringProvider identifier
event_typestring (nullable)Resolved event type
delivery_idstring (nullable)Deduplication key
payloadtextFull webhook payload
headersjson (nullable)Request headers
statusstringpending, processing, processed, failed
processed_attimestamp (nullable)When processing completed
timestampscreated_at, updated_at