Data loss and data corruption are unacceptable events in a production environment. This document outlines how a Generated App maintains data integrity over the evolution of its domain model.

Summary

The database design for Sutro Generated Apps is such that most migrations are inherently safe, preventing data loss and data corruption.

Migrations that risk data loss or corruption are disallowed; some such migrations may be performable by Sutro Support (with appropriate caveats in place).

Future feature sets will broaden the range of allowed migrations by checking constraints and demanding migration expressions to ensure safe conversion of stored values.

SCode

The SCode data structure describes a Generated App.

Each iteration of this structure is associated with a version value, which follows semantic versioning conventions.

<aside> ℹ️

While the structure of the version follows semantic versioning conventions, we do not, currently, compel major or minor version changes whenever certain changes are made. We anticipate adding this feature in an upcoming version.

</aside>

Domain Model representation in SCode

As part of an SCode structure, we describe the data models, their properties and their relationships.

DataModel

The DataModel interface is as follows:

interface DataModel {
	id: ModelId;
	name: string;
	fields: Field[];
	/* ... */
}

A Field has the following interface:

interface Field {
	id: EdgeId;
	name: string;
	relationshipOwner: boolean;
	min: number;
	max: number;
	to: PRIMITIVE_TYPE | ModelId;
	/* ... */
}

The PRIMITIVE_TYPE type represents the typical basic types that you might expect: text, number, boolean, etc.’

The ModelId and EdgeId are simple strings of the form @model/.... and @edge/....

Relationships