0017 - Instantiated Models¶
Date¶
2024-02-07
Status¶
Proposed
Context and Scope¶
This architectural decision record revises our strategy for managing instanced versions of models within our SaaS product, particularly focusing on vehicle models. This revision proposes using instanced clones of the vehicle_model table for customizations. This approach aims to enhance data integrity, scalability, and ease of management.
Decision Drivers¶
- Data Integrity: Ensuring that customizations do not compromise the original model's data.
- Scalability: Facilitating growth in the number of model instances and their customizations.
- Simplicity: Streamlining the process for managing and querying model data.
- Performance: Maintaining high performance levels even with an increase in data volume due to clones.
Decision¶
- Model Template Management
- Creation and Reading: Users can create and read class models (
vehicle_model), with initial restrictions on update and delete actions. This provides a stable template for creating instanced clones.
- Creation and Reading: Users can create and read class models (
- Instanced Clone Management
- Creation of Instanced Clones: When customization at the individual vehicle level is required, an instanced clone of the
vehicle_modeltable will be created. This clone represents a separate instance that can be modified without affecting the original template. - Customization: Customizations are applied directly to the clone, allowing for greater flexibility and specificity in modifications without impacting the base model.
- Creation of Instanced Clones: When customization at the individual vehicle level is required, an instanced clone of the
- Data Retrieval and Dependency Management
- Combined Retrieval Strategy: Access to vehicle details will involve selecting the relevant vehicle instance alongside its clone (if applicable), to present a unified view of the vehicle's configuration.
- Dependency Handling: Relationships and dependencies should be managed carefully so that cloning preserves necessary links while allowing divergence where needed.
- No Direct Mutation of Shared Template
- Direct customization on the shared base model for per-instance use cases will be avoided.
Consequences¶
- Better isolation between template and customized instance data.
- More flexibility for per-vehicle variations.
- Additional complexity in retrieval logic and lifecycle management for clones.