Strapi/Postgres template data loss
My Railway account became frozen at the beginning of the month because the attached credit card got cancelled. I finally was able to put in a valid one today but when I went to check on one of my projects using Strapi and Postgres they were both down. I ran redeploy and when I started up Strapi all my data/settings are gone. I then checked my database and its been completely scrubbed. I had a close call like this last month when I did the recommended update to the database but I was able to recover most of the data from the legacy DB, now I can't access the legacy DB. What did I do wrong? is there a way for me to access the database before it was frozen now that my billing is up to date? Is there any way for me to get back the DB data?
24 Replies
Project ID:
N/A
what mode where you running strapi in?
I was running it develop since I was still changing some of the collections.
on railway?
yeah I was running develop mode on railway so that my coworkers could change some of the content types. Is this where I went wrong? Should I only ever run develop locally? I am more worried about the database, did the redeploy with strapi in developermode scrub the DB?
very likely something along those lines, this is far from the first report of users loosing data after having run strapi in development mode when on railway. going forward please use development mode locally and production when on railway
Understood, won't make that mistake again lol. As far as the postgres DB goes, is there anyway to recover the old data? I had a very similar experience to this a couple of months ago after I updated the DB but was able to find the the backed up tables. Did Railway scrub these with their new DB change?
have you migrated?
I did at the beginning of the year but it dropped all the tables. I ended up having to rebuild the DB based off of a backup of the original DB
so the legacy database is not involved in anyway?
not anymore but its still in the dashboard with the option to delete previous migration and re-migrate. The database still has all the uploaded media and user permissions, just none of the tables I made
The database still has all the uploaded media and user permissions, just none of the tables I madethis referring to the new database, correct?
yeah!
Solution
then yes this was a result of running in development mode on railway
Alright much appreciated, you are a boss ty:)
Do you think re-migrating would bring back the old values?
you said the legacy database was not involved
Oh sorry I thought you meant if it was still being accessed on the live server. The legacy database is what I originally build the site with
then you can try it, but no one but yourself is responsible if something goes wrong
lol yup I only blame myself for getting into this mess. The re-migration is supposed to migrate the database and the data or just the databse structure?
everything
epic
last thing
Not sure if you're the right person to ask but if I rebuild the strapi settings locally and commit it with production mode instead of develop would the redeploy cause the same situation?
as long as you stick to development mode locally, and have railway run strapi in production mode you will be fine, as that is the intended workflow
roger that
I really appreciate all your help. You saved my weekend
happy to help!