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?
Solution:
then yes this was a result of running in development mode on railway
Jump to solution
24 Replies
Percy
Percy9mo ago
Project ID: N/A
Brody
Brody9mo ago
what mode where you running strapi in?
neilyoung777
neilyoung7779mo ago
I was running it develop since I was still changing some of the collections.
Brody
Brody9mo ago
on railway?
neilyoung777
neilyoung7779mo ago
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?
Brody
Brody9mo ago
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
neilyoung777
neilyoung7779mo ago
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?
Brody
Brody9mo ago
have you migrated?
neilyoung777
neilyoung7779mo ago
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
Brody
Brody9mo ago
so the legacy database is not involved in anyway?
neilyoung777
neilyoung7779mo ago
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
Brody
Brody9mo ago
The database still has all the uploaded media and user permissions, just none of the tables I made
this referring to the new database, correct?
neilyoung777
neilyoung7779mo ago
yeah!
Solution
Brody
Brody9mo ago
then yes this was a result of running in development mode on railway
neilyoung777
neilyoung7779mo ago
Alright much appreciated, you are a boss ty:) Do you think re-migrating would bring back the old values?
Brody
Brody9mo ago
you said the legacy database was not involved
neilyoung777
neilyoung7779mo ago
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
Brody
Brody9mo ago
then you can try it, but no one but yourself is responsible if something goes wrong
neilyoung777
neilyoung7779mo ago
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?
Brody
Brody9mo ago
everything
neilyoung777
neilyoung7779mo ago
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?
Brody
Brody9mo ago
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
neilyoung777
neilyoung7779mo ago
roger that I really appreciate all your help. You saved my weekend
Brody
Brody9mo ago
happy to help!
Want results from more Discord servers?
Add your server