Entries deleted inside Cockpit are retained in API

I ran into an issue the other day when trying to delete a large number of entries inside a collection. I used the batch delete option to delete the entries I didn’t need but they still show up when calling the API. Does anyone have any clues on how to fix this?

Indeed, I had the same problem.

At first I thought that by deleting the cache (in settings/system > cache) this would be fixed … but it is not.

I had a singleton named Contact. With data in it (title, content). I deleted the singleton structure and recreated it with the same name and data type … when calling the URI of the new singleton, the data from the old was there again!

The only solution I found was to delete the files that end in .sqlite in /storage/data. The structure of singletons / collections is preserved, because this information is stored in /storage/singleton, /storage/collections, /storage/forms, … ! So remember to also delete the structure directly in the FTP or via Cockpit if it is a problem of data and structure.

Of course the data will be lost … but you will be able to recreate them from scratch (with the good structure).

Be careful, by doing this you will be logged out of Cockpit. The user account used will no longer be recognized. It makes sense as you will have deleted all the data. This could be avoided if I knew which file the user accounts were stored in. To solve the problem, you must restart the installation procedure (by going to site.com/install) … an admin / admin account will be automatically recreated again.

If you’re worried about breaking everything, test locally or on another server.

This is not practical. I don’t know why Cockpit behaves like this. Is this a bug?

These seem to be 2 different things.

1) (Batch) deleting entries from collections

I was not able to reproduce this on the latest next branch.
I tried creating and deleting entries using the batch functionality, querying the api inbetween but it always showed the correct entries. Never deleted ones.

@chechoribero do you have a sure set of steps to re-create the issue? How many entries does your collection have? How many did you delete?
Did you test if refreshing the cache solves the issue? (still, this would be no solution, only an indicator in which direction a fix might be needed)

2) Deleting singletons

When a singleton is deleted, there is actually nothing deleted from the DB but only the singleton spec file is deleted

So if a new singleton is created with the same name and fields the old data entries will still be there. Deleting the cache does not change anything about that.

This is not ideal and I pushed a PR for that - so this might be fixed in the future.