-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: migrate legacy data #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@falconandy changes look great. I appreciate the tests.
- Hmm good call out. I agree we should probably update to include the instanceName. I made a new ticket.
- Thanks for calling out the duplicate instance name, we should definitely try to consolidate. @liuyang1520 can you provide any details on why we have both? Thanks
Thanks @justin-fiedler and @falconandy for the call out! I did a quick check, and cannot find it is used anywhere except assignment. I think I have missed the part to add @justin-fiedler , do you want me to help add the |
👍
I think we (@falconandy ) can fix it in this PR and clean up the RemnantDataMigration and tests accordingly. Would definitely appreciate a code review once it's ready 🙏
Agreed. @falconandy can you please update this as well. Thanks! |
Hi @justin-fiedler @liuyang1520
Done.
It looks like both Amplitude-Typescript and Amplitude-Kotlin do not use For example, Amplitude-Kotlin only adds
Amplitude-Kotlin uses
Should we use |
Hi @falconandy @liuyang1520 I put together a doc to outline instance storage across the SDKs. I think that going forward we should use Please let me know your thoughts in Confluence. If we all agree then I think we can add another migration plugin to check for any pending events in the old |
Hi @falconandy see the latest feedback in the doc. The team agreed to start using I think it will be better to write a new migration (vs a new source). Let me know if you see issues with that implementation. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above.
# Conflicts: # Amplitude-Swift.xcodeproj/project.pbxproj # Sources/Amplitude/Amplitude.swift
Hi @justin-fiedler. Merged with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @falconandy! I also tested on local simulator.
🎉 This PR is included in version 0.4.7 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Summary
Migrate legacy data (Amplitude-iOS SDK)
Based on Amplitude-Kotlin migration logic.
On first run since upgrade (recommended) - device/user id, session id, last event date/id, events, identifies, intercepted identifies. If migration was enabled later after upgrade - only events are migrated.
Some legacy fields are converted to new names/format: library -> from object to string, timestamp -> time, idfa, idfv.
After migration legacy sqlite data are cleaned except deviceId/userId - maybe they will be required later to link legacy/new ids, for example.
NOTE 1:
Probably a bug: instance name is not included in PersistentStorage's
storagePrefix
- a storage is shared between different instances. Not fixed in this PR - for now I created PersistentStorage instances explicitly with different names in new tests.https://github.com/amplitude/Amplitude-Swift/blob/main/Sources/Amplitude/Configuration.swift#L67-L69
NOTE 2:
For some reason there are 2 independent
instanceNames
:Amplitude.instanceName - https://github.com/amplitude/Amplitude-Swift/blob/main/Sources/Amplitude/Amplitude.swift#L5
Configuration.instanceName - https://github.com/amplitude/Amplitude-Swift/blob/main/Sources/Amplitude/Configuration.swift#L14
I use
Amplitude.instanceName
but looks like one of them should be removed (or their values should be synchronized)Checklist