Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MSSQL DB Batch Statement Support #1106

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cbergoon
Copy link

@cbergoon cbergoon commented Jun 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant