Lost all content - what happened?

I originally posted this in the Questions and Answers forum but received no reply there.

This is the issue:

I needed to add author details to a news items content type I had created, so I edited the model as outlined here: Backend customization - Strapi Developer Documentation

I then merged the feature branch I was on into the dev branch and then checked out the dev branch.

I then got 403 errors from the Strapi API in my NextJS project - turns out the previously set permissions had been deleted. In addition to this all the content I had entered into Strapi has completely disappeared. What has caused this? This behaviour is obviously a big red flag for the project - can’t afford for this to happen once the project is live.

1 Like

What database are you using and what where the exact changes you made?

Hi @Boegie19 I’m developing locally:

Strapi Version: 4.5.6
Operating System: MacOS 11.6
Database: PostgreSQL 15
Node Version: 16.13.1
NPM Version: 8.1.2

The change I made was adding "populateCreatorFields": true to options in my news item schema. I then tested this was working. It was, so I then merged the branch I was on into the develop branch and then checked out out the develop branch. Then I was receiving 403 errors from the requests made to my Strapi instance - this was caused by the permissions I had set (Find all, find one) had been removed. In addition to the permissions being removed all the content for all the collection types I had entered into the Content Manager was no longer there. The relevant tables in the PostgreSQL were empty.

@Boegie19 Any idea why this issue may have happened?

What changes you made exactly?

If you update the name of a field (e.g. from name to first_name) it deletes the old one and creates the new field (e.g. all names are gone and a field first_name is created but is empty)

As explained above, the change I made was adding "populateCreatorFields": true to options in my news item schema. I then merged the branch with this change into my dev branch and then checked out my dev branch. I was then just getting 403 errors from all the Strapi endpoints and I discovered that the previously set permissions and all the data for all my collections had been deleted.

Strapi Version : 4.13.7
Operating System : Windows
Database : PostgreSQL 12
Node Version : 16.20.2
NPM Version : 8.19.4

Apparently I have the same problem. I copied my local project from partition D to C and reinstalled it. I then expanded “Extensions\User-Permissions”. After I started “npm run develop”, all data is gone?! It looks like my project did a “hard reset” on itself.

Is the problem already solved? That looks so dangerous. :exploding_head:

Happened to me as well after switching branches today. Is there any way to restore the lost data?

1 Like

Okay, today I’ve updated admin panel, and again got all the local DB data flushed. How to stop that?

Same thing here today. Re-uploaded files to the server and all is gone - tables owned by the Strapi user are flushed, tables which had another owner than Strapi remained intact.

So this is related to the /src directory and some weird init behavior I suppose?

Hey there, I finished working in a dev branch and wanted to merge all changes to the main branch, and after I merged, all of my data was flushed as well, although some collections retain data, any help would be great as well!