Skip to content

How to perform migrations? #5

Description

@edwellbrook

Hi! Thanks for writing and sharing Empire — I'm super excited to play around with it, use it in a small project and help out with smoothing any rough edges.

I'd love to understand the migration process in more detail. In particular:

I can see that I need to implement a custom initialiser. One of the arguments is a version: Int. This is (presumably) the version associated with a previous schemas fieldsVersion, correct?

Where does the version number come from? It seems that this is a compile time computed hash from the fields in the struct. What aspects of the properties invalidate the hash? (Access level? Field ordering? Whitespace/comment changes?)

Is there a way to safeguard against accidentally changing the version?

Is there a way to specify a user defined version without requiring I implement the entirety of IndexKeyRecord myself? (I'm actually open to doing this, but don't feel confident doing that without more docs on each property and what's required of me!)

Given a previous version of a schema, how can I find out its fieldsVersion? In the custom initialiser I'd need to switch over possible options and it's not obvious how to get these values!

Thanks so much for the work that's already gone into this. I'm happy and excited to find a way to work with you on this!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions