https://documentation.red-gate.com/display/SOC5/SQL+Source+Control+5+documentation
To deploy changes from version control, the SQL Compare engine generates a deployment script. This is based on the differences between the state in version control and the target database. Migration scripts in version control can define how the SQL Compare engine generates specific sections of this deployment script.
Migration scripts are necessary to avoid data loss when making certain schema changes. To achieve this, the migration script intervenes to make data changes occur at the right point of the deployment.
In most cases, you only need to write SQL for the data changes in the migration script. Schema changes are committed separately and deployed as normal.
To learn more, see Migration script examples.
SQL Compare 11 or later can generate deployment scripts with migrations using the following source/target types:
Source:
Target:
We recommend using SQL Compare to deploy changes to production, as you have the opportunity to review the deployment script before it‘s deployed. For a full walkthrough of the deployment process using SQL Compare, see Migration script examples.
It is possible to use the Get latest function in SQL Source Control to deploy these changes, however we don‘t recommend linking your production database directly to source control.
Dependencies
When you create a migration script that includes uncommitted schema changes, SQL Source Control automatically includes any dependencies. Deselecting any of these dependencies during the deployment stage will cause the deployment to fail.
Static data
Migration scripts do not work with static data. See Static data and migrations.
To deploy a database from source control to a server, use SQL Compare Pro, or the SQL Server Management Studio Integration Pack add-in.
To deploy with SQL Compare:
原文:http://www.cnblogs.com/chucklu/p/7273601.html