You are developing a new version of an existing website locally. Along with that you are making some changes to the database schema for that website – again locally (through phpMyAdmin).
The new version is ready and you want to upload it to the remote server.
You upload the files through FTP (that’s easy) and now the files are up to date.
How do you update the database schema and make sure it is in sync with the local one?
We save the SQL statements required for the database change in a file, tagged by the version. Whenever a new version must be enrolled, then we import it into the database. First into a test server (an exact replica of our live server minus the live data; this is substituted with random values). When everything works properly, we can move on to our live server.
Summarized: At every version update this entire file is imported into the live database. The file is version controlled as well so it’s easy to roll back any improper statements.