Framework
analyzeSchemaChanges()
Function: analyzeSchemaChanges()
function analyzeSchemaChanges(
stored,
current,
modelName): ChangeAnalysisResultAnalyze schema changes between stored metadata and current schema.
Change classification per spec 13.4:
Safe changes (auto-apply):
- Add optional field
- Add field with default
- Add/remove index
- Add unique constraint (validates existing data)
Breaking changes (require migration):
- Add required field without default
- Remove field
- Change field type
- Remove unique constraint (potential data implications)
Parameters
| Parameter | Type | Description |
|---|---|---|
stored | Record<string, FieldMetadata> | Previously stored field metadata |
current | NormalizedSchema | Current normalized schema |
modelName | string | Model name for change descriptions |
Returns
Analysis result with safe and breaking changes
