Is there anyway to clear out all data in a datastore?

If I wanted to change my structure of how I store data in a datastore in a significant way, which would require resetting all data, would it be possible to remove all old data from the datastore or would I have to use a new datastore?

4 Likes

You must use a new datastore, you cannot clear old data.
Alternatively you could impose a “format” field in your user data. If it doesn’t exist or has the wrong value, you overwrite or convert the old data.

25 Likes

No, you would have to use a new datastore. You can take advantage of the scope argument if you want to use the same name for the datastore.

6 Likes

Yes, that was what I was thinking, checking if their data has the transformation which I wanted to apply, and if their data doesn’t have the transformation, applying the transformation.

3 Likes

This along with some sort of migration sets for different versions would be perfect. Data would never go out of date.

2 Likes

3 years later, i found the solution, here:

7 Likes