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

Support for "multistatements" on sqlserver using GO statement delimiter #756

Closed
tomqwpl opened this issue Jun 27, 2022 · 2 comments
Closed

Comments

@tomqwpl
Copy link

tomqwpl commented Jun 27, 2022

Is your feature request related to a problem? Please describe.
SQLServer is annoying.
There are various things that you can't do "in one go" as it were. Various things require you to use multiple statement batches, separated by the GO statement.
There is no support for GO here. Instead it is necessary to put each part in a separate migrate file, which can be annoying and lead to an unnaturally long collection of files.

Describe the solution you'd like
I can see that Postgres for example supports splitting the migrate statement at ; and running each statement separately.
I can imagine doing exactly the same for SQLServer with GO.

For comparison, flyway always splits the migrate script on GO, or ; or other equivalent database specific separator.

Describe alternatives you've considered
Putting the parts into separate .sql files can be done, but it's annoying and leads to unnatural splitting of the migrate steps.

Additional context

@tomqwpl
Copy link
Author

tomqwpl commented Jul 1, 2022

OK, this is more complex than I hoped.
What I hadn't considered is that GO can exist with an identifier, so splitting has to look for GO surrounded by whitespace.
It looks like flyway takes a slightly more complex approach to parsing the expressions than just splitting on semicolon (which would be necessary to cope with a semicolon within a quoted string for example)

@dhui
Copy link
Member

dhui commented Jul 27, 2022

See #666

@dhui dhui closed this as completed Jul 27, 2022
JorisHeadease added a commit to nuts-foundation/nuts-node that referenced this issue Apr 22, 2024
…to missing batch functionality (see golang-migrate/migrate#756 & golang-migrate/migrate#666).

Also added 2 missing drop index statements in the golang-migrate down scripts.
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

2 participants