Strapi deletes my collections and singles when restarting the server

So let me give a scenario.

You spin and start up 3 strapi instances at the same time.
All of them will try do a database change (Let’s say you changed author to be a number field instead of blocks)

First one starts, (due timing) does the change, then few seconds later the next one does it’s check and does the same change etc. Hence why I think you have the issue.

I was working for a big company before and had a similar issue as we had Multiple Strapi instances connected to 2-3 databases for redundancy.

What I came up with as a good idea is to have a “ops” instance, so ALL strapi instances have migration set to false.
Except for the “OPS” instance. So when doing migration or database changes, you deploy OPS so migration happens, then you roll out the other instances.
This then should ensure that only 1 instance tries to do database modifications at one time and might prevent the issues you are seen.

Okay, I tried your suggestion, but it didn’t work, unfortunenately.

What I found out, however, was that when the container is restarted, then Strapi deletes rows from admin_permissions where created_by_id is empty. So the table for the collection “sms-texts” is never deleted, but my admins permission is.

So I guess the question is why that column is empty?

What version of strapi are you on if I can ask ?

I’m on version 4.6.1 :slight_smile:

i am facing similar problem, few fields data gets deleted without restart, other fields data remains as it is

Check if you have committed your sqlite in your repo. and if new things after the commit is what gets deleted.
Going to guess that’s what the issue is.

Thanks for your reply, we dont use repo, and we are using postgresql as database.