Migrating Postgres to v2 databases has gone horribly wrong. Help

I should mention that I'd already migrated another project with near enough exactly the same stack, with no issues. Started migration and it got stuck at "Deploy V2 Database". After ~10 minutes I decided to have a look at the new database - there were no logs. I manually attempted to redeploy the database (a few times) and it logged some errors about the database already existing. One of the redeploys appeared to be successful, but still showed error messages. I checked the migration status and it was still stuck at "Deploy V2 Database". I decided to delete the new database and create another myself - it successfully deployed within seconds. My migration status is still stuck at "Deploy V2 Database" (~30 minutes later). What can I do now?
48 Replies
Percy
Percy11mo ago
Project ID: a8d6a2f4-5aaf-462c-ad92-3e4d9b4c6399
Lycan Sentry
Lycan SentryOP11mo ago
Project ID: a8d6a2f4-5aaf-462c-ad92-3e4d9b4c6399 Also, I should apologize for kinda fanning the flames on this one. 😬 Maybe if I'd waited a bit longer it would have succeeded. 🤷
Brody
Brody11mo ago
migration hiccup, can you show me a screenshot of the project?
Lycan Sentry
Lycan SentryOP11mo ago
What exactly would you like to see?
Lycan Sentry
Lycan SentryOP11mo ago
No description
No description
Brody
Brody11mo ago
a screenshot of your browser's viewport
Lycan Sentry
Lycan SentryOP11mo ago
I think the first of the above 2 covers that?
Brody
Brody11mo ago
indeed, and just so i know how urgent this is, is your app offline?
Lycan Sentry
Lycan SentryOP11mo ago
Nope. Still functioning.
Brody
Brody11mo ago
go ahead and delete the new postgres database, and that stray volume
Lycan Sentry
Lycan SentryOP11mo ago
To clarify, all of these? Postgres pgdata Postgres data
Brody
Brody11mo ago
correct
Lycan Sentry
Lycan SentryOP11mo ago
Okay, they're gone. Just the Postgres Legacy and my main server process remaining.
Brody
Brody11mo ago
deploy a new postgres database
Lycan Sentry
Lycan SentryOP11mo ago
Done. Still stuck at "Deploy V2 Database".
Brody
Brody11mo ago
we can ignore that, we're doing this manually
Lycan Sentry
Lycan SentryOP11mo ago
😐 Scary stuff. 😂
Brody
Brody11mo ago
it's easy, trust me is your app using reference variables?
Lycan Sentry
Lycan SentryOP11mo ago
As in the database ones? Should they have curly braces in them or something? They appear to all be hard coded... but they have the pg logo next to them.
Brody
Brody11mo ago
look in the raw editor they should look like this example https://docs.railway.app/guides/variables#referencing-another-services-variable
Lycan Sentry
Lycan SentryOP11mo ago
If the references are the ${{}}, then yes.,
Brody
Brody11mo ago
perfect I'm gonna finish my dinner then we can get into this!
Lycan Sentry
Lycan SentryOP11mo ago
No worries. It may be best we continue this much later today as it's 1am here, and I've gotta be up kinda early. 😬
Brody
Brody11mo ago
alright no worries ping me when you are ready to begin
Lycan Sentry
Lycan SentryOP11mo ago
I should have known better than to deploy at midnight. 😂 Catch you later. 👋
Brody
Brody11mo ago
see ya
Lycan Sentry
Lycan SentryOP11mo ago
@Brody you free to walk me through this now? 😁 Actually, "Migration Errored". "Deploy V2 Database - Failed to migrate" Worth me just restarting it?
Brody
Brody11mo ago
it could be, but first let's see a screenshot of your project to catch me up
Lycan Sentry
Lycan SentryOP11mo ago
Just these and my main server process below.
No description
Lycan Sentry
Lycan SentryOP11mo ago
I assume if I were to restart the migraiton I should delete the new PG + pgdata?
Brody
Brody11mo ago
that's correct, but you would also want to rename the legacy database back to just Postgres and I'm forgetting if I've ask you, but you are using variable references right?
Lycan Sentry
Lycan SentryOP11mo ago
Yup.
Brody
Brody11mo ago
yep then do the delete and rename stuff and see if it gives you an option to run the migration again
Lycan Sentry
Lycan SentryOP11mo ago
Will do. 😁
Lycan Sentry
Lycan SentryOP11mo ago
<a:party_parrot:812481236114079784>
No description
Brody
Brody11mo ago
progress
Lycan Sentry
Lycan SentryOP11mo ago
Would you mind explaining the process you would have taken if the migration was still stuck on "Deploy V2 Database"? It'd be useful for my knowledge, and help anyone else that comes across this issue. 😊 Migration has succeded. Looks like all my data's in there, and the app is functioning. 😁 Just an overview would be fine.
Brody
Brody11mo ago
this is the process we would have ran though, just manually. that migration process just deploys this template to migrate your data https://railway.app/template/postgres-plugin-migration
Lycan Sentry
Lycan SentryOP11mo ago
Oh, nice. Just install the migration service, define 2 variables, stop my server, deploy the migration service?
Brody
Brody11mo ago
yep, then swap the namespace of the reference variables over, and you're done
Lycan Sentry
Lycan SentryOP11mo ago
As an alternative, what downsides would creating a database dump and then populating a fresh database with it have? More downtime?
Brody
Brody11mo ago
it depends, because if you don't take your service offline you could end up with missing data in your new database, but if you aren't doing any writes then you could do a backup and restore with zero downtime without taking the service down
Lycan Sentry
Lycan SentryOP11mo ago
It wouldn't have been the end of the world for this app, as it's a bespoke built thing that only gets used every few months. 😂 Thank you for your help. Think this is my first experience with Railway support via Discord, and I'm liking it. 😁
Brody
Brody11mo ago
I'm happy to help!
Lycan Sentry
Lycan SentryOP11mo ago
Will the legacy postgres clean themselves up after the 31st?
Brody
Brody11mo ago
they will be shut down on the 31st and it will offer you one last chance to do a migration before they completely remove them on the 12th of February
Lycan Sentry
Lycan SentryOP11mo ago
Alright. May as well delete them to save on some fees anyway. 😂
Brody
Brody11mo ago
yeah and to get rid of that migration message
Want results from more Discord servers?
Add your server