There are also server-side interactions that may never appear in your PHP code:
Views
Stored Procedures
Triggers
... FOREIGN KEY ON (DELETE|UPDATE) ...
Constraints
Indexes (performance-impacting only, results should still be correct)
Permission GRANTs
Unless you get all of these right, the web site might not work like it used to. All of these complicate a general solution to the problem. You'll have to use your intuition about how things should work behind the scenes.