Built in way to delete all related Shop data of a Shopify store that uninstalled the app

I noticed that when I uninstall my app via Gadget or directly on the Shopify store the data still persists. I'm reading from Shopify review process that this must be addressed and data has to be removed that is related to the store that uninstalled the app. So my questions are: 1. Is there a built in way that Gadget can accomplish this or is this a manual build? 2. Is it that important to get app approval?
6 Replies
Simon
Simon3mo ago
Must build yourself. But that’s pretty quick. Use deleteMany via api.internal.model.deleteMany. Apply shop id as filter. 2: they don’t have a way to check your db. So no.
webzer33
webzer33OP3mo ago
Thank you. Also, is using encrypted string column type good enough to comply with PII protection?
Chocci_Milk
Chocci_Milk3mo ago
The information that Simon shared is valid but I believe that the data only needs to be removed once the shop/redact GDPR webhook comes in.
evidanary
evidanary2mo ago
Simon and Antoine, we want to keep a record of how many records if any were deleted by api.internal.model.deleteMany. I see awaiting on that function simply returns an undefined. Is this the intended success scenario? If yes, can you confirm if failure scenario will always throw an error?
Simon
Simon2mo ago
I think you're right that gadget doesn't give you that info. If you really need it, you must count those yourself first. Or submit a feature request, because postgres should return that data(?). You could potentially use the views feature (probably overkill), a simple computed field (might time out though if you have a ton of records), or just paginate through it yourself.
Smelvin
Smelvin2mo ago
Yes the internal API is a direct low-level access, so you're bypassing functionalities like onSuccess as an example. So yes the undefined return is the intended scenario

Did you find this page helpful?