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

Reports Errors from Goose MIgration Scripts #1386

Open
dfdumaresq opened this issue Oct 11, 2024 · 0 comments
Open

Reports Errors from Goose MIgration Scripts #1386

dfdumaresq opened this issue Oct 11, 2024 · 0 comments

Comments

@dfdumaresq
Copy link

dfdumaresq commented Oct 11, 2024

Type: Bug

When using the MS SQL Server extension in Visual Studio Code, there is a problem with error reporting in Goose migration scripts. Specifically, the extension incorrectly highlights errors when the migration scripts contain multiple stored procedure definitions. The Goose migration scripts use special directives like -- +goose StatementBegin and -- +goose StatementEnd to handle multiple SQL statements, but the extension does not recognize these directives, leading to false error reports.

Steps to Reproduce:
Install the SQLTools Microsoft SQL Server/Azure extension in VS Code.
Create a Goose migration script with the following content:
-- +goose Down

-- +goose StatementBegin
CREATE PROCEDURE [dbo].[FirstProcedure]
AS
BEGIN
-- Sample procedure logic
END
-- +goose StatementEnd

-- +goose StatementBegin
CREATE PROCEDURE [dbo].[SecondProcedure]
AS
BEGIN
-- Sample procedure logic
END
-- +goose StatementEnd
Open the script in VS Code and observe the error reporting and syntax highlighting.

Expected Result: The extension should recognize the -- +goose directives as valid comments and not report errors for having multiple stored procedure definitions in the same file. The syntax highlighting should be accurate and not show errors for valid SQL code.

Actual Result: The extension reports errors due to the presence of multiple stored procedure definitions, even though the Goose directives (-- +goose StatementBegin, -- +goose StatementEnd) are meant to handle such cases. As a result, there are false error highlights throughout the script, which makes it difficult to edit the migration files.

Workaround: Using GO as a batch separator between stored procedure definitions helps reduce the false errors, but this workaround is not ideal as GO is not officially supported by Goose.

Suggested Solution: Add support for recognizing Goose migration directives (-- +goose StatementBegin, -- +goose StatementEnd, etc.) as valid comments in SQL scripts to avoid false error reporting.

Extension version: 0.4.3
VS Code version: Code 1.94.0 (Universal) (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Darwin x64 23.6.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.02GB free)
Process Argv --crash-reporter-id 161e5da9-f592-4143-baa2-0a9d01a1bfab
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
cp13037c-prod:31155933
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
da93g388:31013173
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-t:31132770
wkspc-ranged-t:31151552
cf971741:31144450
autoexpandse:31146404
iacca2:31156134
notype1:31151523
controlgs:31153265
5fd0e150:31155592

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

No branches or pull requests

1 participant