There has been a major push to switch to Infrastructure-as-Code through things like Terraform and AWS's CDK/CloudFormation. How do companies manage their relational database schemas though? Are there tools that will accept a schema change and then apply it for you? Right now I am working on a personal project and the thought of just using pgAdmin to make any sort of production change to a database feels very dangerous.
Thanks, and apologies in advance for the RDBMS naivety; I come from an almost exclusively NoSQL shop.
The phrase you need is "database migration". Typically you would have a set of .sql files to apply a single revision to your schema and (ideally) to reverse that change.
These files would be under version control with the rest of your code and might be run through psql. Alternatively, some ORM layers generate migrations from their internal schema definitions and run them for you.
The tricky bit comes when your schema changes are complex and cannot practically be reverted, or require a long time to complete and take heavy locks.