@@ -52,6 +52,7 @@ erDiagram
5252 ApiClient ||--o{ ApiClientDmsInstance : "can access"
5353 DmsInstance ||--o{ ApiClientDmsInstance : "accessible by"
5454 DmsInstance ||--o{ DmsInstanceRouteContext : "has"
55+ DmsInstance ||--o{ DmsInstanceDerivative : "has"
5556
5657 Application {
5758 bigint Id PK
@@ -85,6 +86,13 @@ erDiagram
8586 varchar ContextKey
8687 varchar ContextValue
8788 }
89+
90+ DmsInstanceDerivative {
91+ bigint Id PK
92+ bigint InstanceId FK
93+ varchar DerivativeType
94+ bytea ConnectionString
95+ }
8896```
8997
9098#### DmsInstance
@@ -112,6 +120,23 @@ Stores context key-value pairs for route-based instance resolution.
112120** Constraint:** ` UNIQUE (InstanceId, ContextKey) ` ensures each instance has
113121only one value per context key.
114122
123+ #### DmsInstanceDerivative
124+
125+ Stores derivative instances (read replicas and snapshots) associated with a parent DMS instance.
126+
127+ | Column | Type | Description |
128+ | --------| ------| -------------|
129+ | Id | BIGINT | Primary key |
130+ | InstanceId | BIGINT | Foreign key to parent DmsInstance |
131+ | DerivativeType | VARCHAR(50) | Type of derivative: "ReadReplica" or "Snapshot" |
132+ | ConnectionString | BYTEA | Encrypted database connection string |
133+
134+ ** Foreign Key:** CASCADE DELETE on ` InstanceId ` - when a parent DmsInstance is
135+ deleted, all its derivative instances are automatically deleted.
136+
137+ ** Index:** ` idx_dmsinstancederivative_instanceid ` on InstanceId for efficient
138+ queries.
139+
115140#### ApiClient
116141
117142Stores OAuth client credentials for applications.
@@ -132,6 +157,15 @@ Maps API clients to DMS instances they can access (many-to-many).
132157| ApiClientId | BIGINT | Foreign key to ApiClient |
133158| DmsInstanceId | BIGINT | Foreign key to DmsInstance |
134159
160+ ## DMS Instance Derivatives
161+
162+ DMS Instance Derivatives are alternate database instances associated with a parent
163+ DMS instance, such as read replicas or snapshots. Read replicas distribute query
164+ load, while snapshots preserve point-in-time data for backup, testing, or analysis.
165+
166+ Each derivative type is stored with its own encrypted connection string and is
167+ automatically deleted when its parent instance is removed (CASCADE DELETE).
168+
135169### Configuration
136170
137171DMS instance and route context configuration is managed through the DMS
0 commit comments