Persistent schema is defined in Prisma and stored in PostgreSQL.
The data model combines:
- relational ownership and foreign keys for core lineage
- JSON/JSONB-style fields for flexible metamodel/model/view structures
- explicit share records for cross-user collaboration
Represents authenticated users and role assignment.
Key fields:
id,email,passwordrole(ADMIN,DSL_DESIGNER,MODELER,VIEWER)isSuspended,lastLogin
Owns all primary resources through userId relations.
Maps owner resource access to recipient users.
Key fields:
resourceType,resourceIdpermission(VIEWER,EDITOR)ownerId,sharedWithId
Unique constraint prevents duplicate share rows per resource/user pair.
Meta-metamodel package (Ecore-like foundation).
Key fields:
name,nsURI,nsPrefixclasses(JSON)userId
User-defined modeling language.
Key fields:
name,uri,prefix, optionaleClassclasses(JSON)enums(JSON)constraints(JSON)conformsToId(EPackage FK)userId
Metaclass JSON can include concrete syntax metadata for class-level 2D/3D notation. Reference JSON can include edge notation metadata. This is fallback notation; role-specific or representation-specific notation belongs in a Viewpoint representation description.
Definition-level modeling perspective for one metamodel, aligned with Sirius Viewpoint terminology.
Key fields:
name, optionaldescriptionmetamodelId(Metamodel FK)representationDescriptions(JSON)sharedConcreteSyntax(JSON)isDefaultuserId
Viewpoints are not concrete user views. They define available representation kinds, visible concepts, creatable concepts, notation overrides, edge mappings, pin mappings, and palette/tool definitions. Representation descriptions are embedded JSON in the first implementation.
These records are SpatialDSL specification data. They are aligned with Sirius terminology, but they are not serialized as Sirius .odesign files.
Instance-level data conforming to a metamodel.
Key fields:
namemetamodelId(duplicate convenience field)elements(JSON)connections(JSON)conformsToId(Metamodel FK)userId
Model elements own canonical presentation metadata:
- 2D and 3D position
- 2D and 3D size
- rotation
- optional instance-level appearance override
- optional attachment metadata for pin-like nodes (
attachedToElementId, side, offset ratio)
Views project this data rather than duplicating it.
Compatibility resource representing a view bound to a model. The database table and API still use Diagram; user-facing UI labels increasingly use View.
Key fields:
namemodelId(Model FK)- optional
viewpointId - optional
representationDescriptionId includedElementIds(JSON)gridSettings(JSON)schemaVersionmigrationWarningselements(legacy JSON kept for compatibility)userId
Notation resolution order is instance override, representation description, viewpoint shared defaults, metaclass fallback, then built-in fallback.
Diagram/View records are not Sirius .aird representation files. They are SpatialDSL view resources backed by model membership and presentation data.
Transformation rule with embedded patterns.
Key fields:
name,description,priority,enabledlhs(JSON),rhs(JSON),nacs(JSON)conditions(JSON)- optional
diagramId userId
Project-level container for codegen templates.
Key fields:
name,description,isExample- optional
targetMetamodelId templates(JSON)userId
Model/metamodel testing definition and status tracking.
Key fields:
name,description,type,status- target class/property fields
- optional constraint fields
testValues(JSON)- optional
modelId userId
Binary file storage in database.
Key fields:
filename,mimetype,size,typedata(Bytes)metadata(JSON)userId
UserRole: ADMIN, DSL_DESIGNER, MODELER, VIEWERResourceType: METAMODEL, MODEL, DIAGRAM, TRANSFORMATION_RULE, CODEGEN_PROJECT, TEST_CASE (DIAGRAMis the compatibility resource type for views)SharePermission: VIEWER, EDITORTestCaseType: attribute, reference, constraint, reference_attributeTestCaseStatus: pending, running, passed, failedConstraintType: ocl, javascriptFileType: image, model, other
Primary resources include userId ownership.
Isolation model:
- owners can fully manage owned resources
- cross-user access is only through sharing records
- cascade deletes on some relations enforce cleanup
Shared access is represented explicitly in SharedResource.
Semantics:
- owner defines recipient and permission
- effective access combines recipient role and share permission
- only one row per
(resourceType, resourceId, sharedWithId)
Main dependency chain:
EPackage->Metamodel->Viewpoint->RepresentationDescriptionMetamodel->Model->Diagram/ViewDiagram/View-> optionalViewpoint+RepresentationDescription
Additional dependency links:
CodeGenerationProject.targetMetamodelId(optional)- transformation and test resources linked by domain identifiers and ownership
JSON fields are used for flexible domain objects:
- class definitions
- model elements and connections
- model element presentation and connections
- view membership and grid config
- transformation patterns
- template collections
- test values and IO snapshots
Implications:
- rapid schema evolution for modeling payloads
- fewer SQL-level constraints inside nested structures
- validation and consistency logic moved to service layer
Current migration set:
20260123031348_init20260123055303_make_target_metamodel_id_optional20260223024320_add_rbac_sharing20260321071500_sync_user_schema_for_auth20260427000000_add_view_membership_to_diagrams20260525000000_add_metamodel_enums20260528000000_add_viewpoints