Skip to content

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.

@barnesew
Copy link

Hey @dhui! Are the CI/CD tests accurate for this PR? It looks like many recent PRs have also failed, and we're unsure if there's something we can fix.

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.

2 participants