PostgreSQL 12 to 15 works directly without going through intermediate versions, so pg_upgrade is your way to go. What does matter here is that before running pg_upgrade, you need to do a full backup with pg_dump or a physical backup - not for the migration itself, but as a safety net. A lot of people skip this step because they trust that pg_upgrade will work, but if something goes wrong with 50GB of data, you don't want to be praying.
The process is pretty straightforward: you install PostgreSQL 15 on the same server (or on a parallel one if you prefer), pause writes to the database, run pg_upgrade with the `-k` flag to keep the old files as a backup, and let it run. With 50GB it might take 5-15 minutes depending on your hardware, but then you have everything converted in-place without exporting/importing anything. Once you confirm everything works fine, only then do you delete the old files from version 12.
The important thing you don't see mentioned is verifying extensions and custom configurations. If you have extensions installed, pg_upgrade can have issues - you need them to exist in PostgreSQL 15 as well. Before doing anything, check `SELECT extname FROM pg_extension;` in your current database and confirm that all those extensions support version 15. That's where things tend to fail most, not in the data migration itself.