migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Add MSSQL DB Batch Statement Support

Open cbergoon opened this issue 4 weeks ago • 0 comments

Adds support for "batch" statements using the "GO" keyword supported by SQL IDEs such as SSMS or Azure Data Studio.

This logic for parsing the batched statements is implemented by the standard MSSQL DB driver: github.com/microsoft/go-mssqldb and specifically included in the github.com/microsoft/go-mssqldb/batch package.

By default this functionality is not enabled. To enable it, a configuration option named BatchEnabled must be set to true. This parameter can be set through the connection URL using the parameter x-batch-enabled.

A common use case requiring batched statement is creating more than one view in a single file. SQL Server does not allow multiple views to be created in a single batch. Below is an example of multiple batches in a single migration file to create views:

CREATE VIEW [dbo].VxTest1 AS SELECT 1; 

GO 

CREATE VIEW [dbo].VxTest2 AS SELECT 2; 

GO

This migration will result in an error about an unsupported command if the BatchEnabled option is not true.

There is no breaking functionality.

Additionally, this PR introduces a new build artifact for Apple Silicon chips (M1, M2, M3, etc). It is a Darwin ARM64 build.

cbergoon avatar Jun 07 '24 01:06 cbergoon