SQL Change Automation 4

Applying changes to a database in SSMS

Apply changes to database allows you to keep your development database up-to-date by running any migration scripts in the SQL Change Automation project that haven’t yet been applied to the database.

1. Navigate to the Migrations page

This page will display a series of folders holding your scripts. You can view your scripts by expanding any of the folders.

2. Create a new script

Right-click on a folder and select New Migration. Alternatively, you can select a folder and click New Migration in the action bar along the top of the page.

3. Edit the script

To open the script, double-click the file name from the Migrations page. Copy the following code into the script editor.  Make sure you do not remove the Migration ID header.

CREATE TABLE dbo.tblTest (
    ID INT NOT NULL,
	Name VARCHAR(50) NULL,
    CONSTRAINT PK_tblTest PRIMARY KEY (ID)
);

Once you have edited the script, click Save. This saves the file to the project, but no changes have been made to the database yet.

4. Navigate to the Apply to the database page

In your SQL Change Automation window, navigate to the Apply to database page.

Your new script will be marked as Pending. If you'd like to make further changes to your script, you can click on the file link to open in a new window.

Any other unapplied changes that have been made to your project will also appear here (for example, changes pulled from version control).

5. Apply the script

Click the Apply button in the top-right corner. This will run the pending scripts on your development database.

6. View the summary

After the migrations have been applied, a summary page will show to indicate the changes that have been applied.

7. View your changes

If you refresh your database in the SQL Server Management Studio Object Explorer, your changes will now appear.

Next steps


Didn't find what you were looking for?