# Phase 1 Data Model: Service ID Synchronization and Cross-Filter Recovery

## Entities

### `ResourceMapping`

Persists the discovered external integer IDs and maps them to universal UUIDs.

**Fields**:
- `id` (Primary Key, integer)
- `environment_id` (String, foreign key or reference to Environment configuration)
- `resource_type` (Enum: `chart`, `dataset`, `dashboard`)
- `uuid` (String, UUID format, unique per env + type)
- `remote_integer_id` (Integer)
- `resource_name` (String, human-readable name for UI display)
- `last_synced_at` (DateTime, UTC)

**Constraints**:
- Unique constraint on `(environment_id, resource_type, uuid)`
- Unique constraint on `(environment_id, resource_type, remote_integer_id)` (Optional, but generally true in Superset)

## Validations
- `remote_integer_id` must be > 0
- `environment_id` must be an active, valid registered environment
