Skip to content

Support for in-place upgrades #88

@zeitlerc

Description

@zeitlerc

Consider the scenario where the desired object structure changes:

  • Properties are added and may need a default value
  • Property names are modified or removed
  • Property values are transformed
  • Properties are wrapped in another object

The two main options are

  1. Run script to upgrade all objects at same time. Requires downtime during the upgrade since serializing/saving an non-upgraded object would cause data issues.
  2. In-place upgrade. V1 objects are transformed into V2 objects on read. Any saves will upgrade the object to V2 permanently. Upgrade scripts can be run during off-peak hours (so versions do not get too far behind).

For Argo to support in-place upgrades, it would need to:

  • Support transforming the result from the API into another structure. That might be json serialization options or some explicit transformation from structure A to B. This also needs to be supported for relationship fetches.
  • Support saving these structure changes. Specifically, the Patch property would not currently pick up any object changes to the raw json. It only tracks the property setters.
[Model("person")]
public class PersonV1
{
    [Property]
    public string FullName { get; set; }
    [Property]
    public DateTime DateOfBirth { get; set; }
    // Other properties...
}
[Model("person")]
public class PersonV2
{
    [Property]
    public Identity Identity { get; set; }
    // Other properties...
}
public class Identity
{
    // Split FullName of V1 object into 3 components
    public string FirstName { get; set; }
    public string MiddleName { get;set; }
    public string LastName { get; set; }
    public DateTime DateOfBirth { get; set; } // Moved from root Person into Identity
    public Gender Gender { get; set; } // Default me to Gender.Unknown
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions