yogthos / migratus

MIGRATE ALL THE THINGS!
651 stars 95 forks source link

Warn on multiple statements without delimiter #270

Closed Gwonwoo-Nam closed 1 month ago

Gwonwoo-Nam commented 1 month ago

solves #258

Why:

If users are unaware that SQL statements are split by the default --;; delimiter, it could lead to errors during parsing. This PR adds a warning log to alert users when multiple SQL statements are detected without the use of the correct command-separator. The warning ensures that users are aware of the default separator and can properly structure their SQL commands to avoid parsing issues.

Description:

The SQL input is split by the default separator --;;. Each command is parsed by parse-commands-sql based on the command-separator. When the command-separator is specified, the command is split into a sequence. If no command-separator is specified, the command is not parsed.

In cases where no command-separator is specified and the command contains more than one semicolon, it is considered to contain multiple SQL statements. A warning will now be issued in such cases to inform the user of the potential issue.

yogthos commented 1 month ago

Thanks, that's a good idea. I just pushed out 1.6.0 release with the changes.