a month ago
I woke up to an email saying my database has crashed, I tried restarting it but it kept crashing. So i created a new database but when I try migrating data but I keep getting "django.db.utils.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request."5 Replies
Status changed to Open Railway • about 1 month ago
a month ago
I've had the same today. I redeployed postgres instead of restarting it and it came back online
a month ago
I also redeployed but Migrating data from local instance is not working
a month ago
that migration error usually means the source DB is still dying while Django is reading from it, not that your local migration command is wrong.
I would avoid running Django migrations as the recovery method. first get a dump from the old DB with pg_dump, then restore that into a fresh empty Postgres with psql/pg_restore.
if the old DB only stays up briefly, run the dump from a temporary Railway service in the same project/network so latency is low. after restore, point Django to the new DB and only then run migrations if the schema actually needs it.
a month ago
Thank you. I wish I had this information before deleting the database. It was just a test website for I didn’t loose any data.
dankyibenjamin
Thank you. I wish I had this information before deleting the database. It was just a test website for I didn’t loose any data.
a month ago
yeah hahaha. lost a bit too many nights with similar mistakes too
Status changed to Open dev • 26 days ago
