Yes I think that plan is your best bet. One option is to leave the old field in your source code but comment it out, so you have a record of the field as it was previously defined. You may also want to mark the field numbers and names as "reserved":
https://developers.google.com/protocol-buffers/docs/proto#reserved On Tuesday, February 16, 2016 at 8:56:05 AM UTC-8, Vincent Dupuis wrote: > > I'm facing the exact same problem. > Did you find any way to migrate data with PB? > The only way I can think of is to keep generated code of each schema > version and program the migration with that. > > > On Thursday, May 8, 2014 at 4:39:50 PM UTC-4, Klaus Kraft wrote: >> >> Hi, >> >> so far I have defined messages and the only changes I had to handle were >> additions and deletions of fields and renamings of fields. It was no >> problem to handle this using ProtoBuf. Now I am in the situation that I >> defined a message and a field of the message needs to be moved to a field >> of another message. How can one handle such a data migration scenario? The >> main problem is that I do not want to lose the data that was associated >> with the original field that is moved. >> >> I would also be interested in how to handle comparable, complex, data >> migration scenarios that go beyond additions, deletions and simple >> renamings. If there is no direct support from ProtoBuf, is it possible to >> implement migrations in Java (I'm using Java as my target language)? >> >> Thanks in advance. >> > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
