I want to set up a staging server to do final test for my website. The staging site's database is replicating production master mysql db in order to reflect a real environment.
If a deploy only contains code changes, it's easy to deploy it first to staging and then to production if it's stable enough.
But if a deploy contains database changes, how can I deploy it to staging without influencing master's database but still keep it realtime sync with master db?
Edit:
If it can't be done. How can I make the data write to staging server 'not lossing'? If some user use the beta site, I don't want their data be lost when staging finally became stable.
I wonder how facebook or google roll out their new features without losing beta tester's data?