3 ms·
My two cents: always source control your databases. I don't care if you are code first or database first, but I do think database schema and migration scripts
by WorldMaker 8y ago
My two cents: always source control your databases.
I don't care if you are code first or database first, but I do think database schema and migration scripts are code artifacts and need to be source controlled somewhere.
You should be able to track who made a change and when and what for, and maintaining by hand a "commit list" in a comment at the top of a stored proc doesn't count.
You shouldn't need a full backup of a Production database to spin up a new test server, and you shouldn't need to rifle through every developer's documents and desktop folders looking for random .sql script files to figure out if you are missing a migration/update/refactor script somewhere.
(The argument that you rarely spin up a new Production server is I think tempered by how many developers and testing environments you need. Setup time for developer/testing instances indicates a part of how long onboarding new developers may take; and here I lean to the side of developer productivity and good backups.)
Most code first methods give you source control "for free", which makes them easy to recommend to junior developers / small startup projects.
Visual Studio has decent SQL Server Project support to help with the database-first crowd, as one option I've relied on heavily. Unfortunately, I've yet to see an open source, more database agnostic relative to it.