-
|
Say I have a flutter app installed on client phones. (I don't have one atm, just wondering.) I see that changing db schema in backward-compatible ways (e.g. adding new fields) doesn't break clients using the older schema - the clients just ignore the new fields. But what if I want to introduce breaking changes into my schema, say remove a field. That would break my older clients. How would I go about it? I mean, is it all up to me to decide or would there be any recommended way? Should I create my version check endpoint using trailbase typescript api and force older clients to upgrade the app? Other variants? I don't have a particular use case. Just wondering. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
Generally, there isn't much a backend can do when the consuming code asserts invariants, e.g. requires a specific field to be present. This is also the reason why protobuf version 2 => 3, they abandoned Otherwise, breaking changes will require coordination. This is not specific for TrailBase and you can find many opinions and strategies. Typically, it will look something like:
As you point out, it's generally a better user-experience if you have a mechanism in place to notify users who didn't make the cut (3), rather than just crashing the app. This requires foresight and a version-check API, just like you said.
Now that you bring this up, TrailBase could probably provide a generic "latest migration" applied API. Let me think about this... Great question. Hope I'm making some sense 😅 |
Beta Was this translation helpful? Give feedback.
-
|
You're totally making sense. Thanks for the expanded answer. That "latest migration" applied API is probably what I was really asking about. Like can I get some help from TB with versioning or am I totally on my own? Can you tell what you had in mind with that API even if it's just a vague idea. I'd like to hear. |
Beta Was this translation helpful? Give feedback.
Generally, there isn't much a backend can do when the consuming code asserts invariants, e.g. requires a specific field to be present. This is also the reason why protobuf version 2 => 3, they abandoned
requiredfields. Similarly, if you only add/remove nullable columns, similarly the client will need to handle the null case explicitly and removal is safe.Otherwise, breaking changes will require coordination. This is not specific for TrailBase and you can find many opinions and strategies. Typically, it will look something like: