Handle Getting New NOT NULL Columns
In a dedicated development model where each developer works against their own copy of the db, if my co-worker adds a new NOT NULL column to a table, the get latest script will fail for me since my table contains data and NULLS are not allowed in this new column.
Please comment on how you would like to see us handle this?
SQL Source Control 3.0 is now available!
It includes a new feature called ‘Migrations’ that will help avoid data loss when adding a NOT NULL column as it allows you to create, store and share SQL change scripts for accurate deployment.
For more information about Migrations, please visit:
http://www.red-gate.com/supportcenter/Content/SQL_Source_Control/help/3.0/SSC_Working_With_Migrations
-
An Early Access build of SQL Source Control 3.0 is available which inlcudes a new feature called "SQL Migrations".
This feature allows you to create, store and share SQL migration scripts for accurate, automated deployment using SQL Source Control and SQL Compare.
So, in the scenario you describe you are now able to add a script (that you author) that covers the addition of the new NOT NULL column. This script is then used when Get Latest is used by your co-worker.
The installer zip can be found here:
https://www.surveymk.com/s/SqlSourceControl_DownloadAs I said, this is an Early Acces build - so does not include all the functionality we are hoping to provide with "SQL Migrations". We'd love to hear your feedback regarding whether this feature provides a good solution to the problem you've described.
-
One way to handle this is to allow for arbitrary scripts to be checked in, which could handle how this new column should be populated initially. You can vote/comment on this feature at https://redgate.uservoice.com/forums/39019-sql-source-control/suggestions/982063-allow-for-arbitrary-scripts-to-be-checked-in-to-ad.