How does craft deal with Plugin databases when updating plugin versions? Quick scenario.

I build a plugin with a database. Few months down the line I want to upgrade this plugin which will alter the plugin DB. If installing an update to a plugin how does craft deal with not over writing the existing database data? I know in EE you set up separate install and update functions but I can't find anything in the documentation in craft regarding this and the plugins I've pulled apart don't seem to include anything to deal with updates?

Any advice or pointers to some good documentation on this would be appreciated.

Cheers
Every time Craft notices that a plugin's version number has changed (I imagine quite near the start of every request,) it checks for any new Database Migrations in that plugin that might need running in order get the database schema caught up to the code. That link, and this one for database queries should be enough to get you started.