How to version/track changes to SQL tables

managementsqlversion control

When working in a team of developers, where everyone is making changes to local tables, and development tables, how do you keep all the changes in sync? A central log file where everyone keeps their sql changes? A wiki page to track alter table statements, individual .sql files that the devs can run to bring their local db's to the latest version? I've used some of these solutions, and I'm tyring to get a good solid solution together that works, so I'd appreciate your ideas.

Best Answer

I use a code-based Database Migration tool and keep the migration code in source control.

By using timestamps as version numbers, any number of devs are mostly free to add migrations as they please and we can run the Migration tool against any copy of our database confidently.

I used to use SQL Scripts under version control, but find the code-based approach much, much easier to work with due to them all being in one logical "spot" and being able to execute all needed scripts with a single command.