The naive approach: write your ALTER TABLE statement, run it in production, hope the table lock resolves before monitoring alerts fire. For small tables, this works. For a table with 50 million rows, ALTER TABLE can lock for minutes.
The professional approach: deploy code handling both old and new schemas simultaneously. Run the migration using online schema change tools (gh-ost for MySQL, pg_repack for PostgreSQL) that build the new table in the background. Verify data integrity. Remove the backwards-compatibility code.
This is slower. It requires more discipline. And it keeps your production system healthy.
Schema changes are not deployments. They are operations. Treat them accordingly.
— Dick Bassey | DevDick | 2023