Skip to content

Conversation

@evadnoob
Copy link

@evadnoob evadnoob commented Jan 24, 2022

existing multi-statement parsing was not aware of lines that start with -- this new function implementation could be extended in the future to support end of line comments as well as embedded comments.

for now I chose to go with a very naive scanner/lexer, it could easily be converted to use a state machine to emit statements, but this method is simple enough to be placed directly in migrate with little changes. Possibly good enough for now.

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you hit issues with ; inside comments (or commented out statements)?
multistmt is intentionally naive for simplicity.
Maybe it's better to make multistmt configurable with different parsers. Then you could use DB specific parsers...

Also, any new code should have adequate test coverage.

package main

import "github.com/golang-migrate/migrate/v4/internal/cli"
import "github.com/getoutreach/migrate/v4/internal/cli"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo your import changes

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