Strapi 4.2.2 Data Loss

I’m working on a project that uses Strapi 4.2.2, but occasionally some data will be wiped.

I don’t know what the exact cause is because I’m having trouble reproducing this issue, but I have narrowed it down to a couple of possible causes:

  • Restarting of the PC
  • Merging of git branches
  • Multiple people working on a git branch

Data will sometimes be completely wiped from collection types and permissions will be reset to not having any at all.

The OS is Windows 10 and I use a MySQL database.

I’ll keep trying to figure out how to reproduce this issue as it’s super annoying and I would like to be rid of it.

Has anyone run into a similar problem?

I haven’t exactly run into similar problem, but it might be caused: If anyone keep changing the items on the content type model, it will run a migration each time you pull the code and run strapi. Depending on the changes to the models, you can wipe entire tables or fields in a table.

If this is the case I will recommend having some kind of test, commit hooks or github checks to prevent edits to models going live without proper checks. Also having this settings in the database.js config should prevent forced migrations:

  settings: {
    forceMigration: false,
  },
2 Likes

Thank you for your reply!

I will pass this on to the others working on this project, and maybe this will rid us of this issue.

Hello, I’m a new Strapi user. I uploaded my Strapi backend via Heroku, but the data I entered every night is lost and it’s like my Strapi backend is reset. Is there anyone who can help me with this?

1 Like

Welcome to the community.
Make sure you are not using sqlite as that’s what it sounds like you are doing.
Sqlite database with heroku will reset your database everytime the container / dyno stops and sleeps.
You want to use PostgresSQL etc as a database so the data is persistent.

1 Like

i have same issue i am using strapi deplou on render and use mysql db in sometime automatically data loss please help

Hello Eventyret,
maybe you can help me. I posted here and I probably have the same problem.
Thanks in advance :beer:

Why make 3 seperate post of the same question, where only the name is changed.
Other posts removed.

Oh, sorry, that was just for more attention.