Not much use in the modern world, but SQL Server has this and I've had too many projects to approach doing it for pgsql. In Visual Studio there was a SQL project, and in it you would write your SQL as though you were bringing up the DB from scratch; with directories and all for your convenience.
Internally it would materialize it all into a schema which could not only be used for things like go to def, but also for diffing against another schema - either a previous build, or your live db, and subsequently emitted as a migration. It was magical, but flew under the radar, and these days any individual stuck working with SQL Server deserves many condolences.
I will say though, when you are dealing with many disconnected instances, it can become a nightmare to manage. Such as an "enterprise" or govt app that is deployed to multiple different places at different versions, with different update windows/schedules.