/** * Schema Snapshot Manager * * Manages the schema snapshot at .apso/sandbox/schema-snapshot.json. * The snapshot stores the .apsorc content at the time of last successful migration. * Comparing current .apsorc against the snapshot detects whether a migration is needed. */ /** * Shape of the stored snapshot (mirrors the parsed .apsorc structure) */ export interface ApsorcSnapshot { entities: Array<{ name: string; fields?: Array<{ name: string; type: string; nullable?: boolean; unique?: boolean; default?: unknown; index?: boolean; }>; primaryKeyType?: string; created_at?: boolean; updated_at?: boolean; scopeBy?: string | string[]; }>; relationships?: Array<{ from: string; to: string; type: string; to_name?: string; nullable?: boolean; bi_directional?: boolean; cascadeDelete?: boolean; }>; version?: number; rootFolder?: string; apiType?: string; } /** * Subset of ParsedApsorc we use for comparison. * Avoids importing the full ParsedApsorc type which carries runtime-only data (relationshipMap). */ export interface ComparableSchema { entities: Array<{ name: string; fields?: Array<{ name: string; type: string; nullable?: boolean; unique?: boolean; default?: unknown; index?: boolean; }>; primaryKeyType?: string; created_at?: boolean; updated_at?: boolean; scopeBy?: string | string[]; }>; relationships?: ApsorcSnapshot["relationships"]; } /** * Read the saved schema snapshot, or null if none exists. */ export declare function readSnapshot(projectDir?: string): ApsorcSnapshot | null; /** * Write a schema snapshot to disk. */ export declare function writeSnapshot(schema: ApsorcSnapshot, projectDir?: string): void; /** * Delete the snapshot and sandbox directory contents (for --reset). */ export declare function resetSnapshot(projectDir?: string): void; export declare function hasChanges(current: ComparableSchema, snapshot: ApsorcSnapshot | null): boolean;