Smart evolutions statements parsing


(Vadim V.Kh) #1

Hello! I got an advice in Play contributors Gitter to ask here (i’ve posted in the now-abandoned Google group some months ago as well).

Quoting myself and some other user from Play Github about being forced to escape semicolons by doubling:

“…this is extremely painful while working with Postgres stored procedures.
You have to manually escape/unescape a body of a procedure or run some silly scripts
while copying a procedure code from a migration file and a database IDE/REPL back and forth
(a double semicolon in a procedure body produces an empty statement which is disallowed in pl/pgsql)…”

https://github.com/playframework/playframework/pull/649#issuecomment-112556094

“For example with plpgsql I have to use semicolons in a procedure declaration.
It’s annoying to escape it by entering one more.
And I have to remove it to run the same script in pgAdmin or IntelliJ.”

A change is proposed. Keep to require escaping semicolons by doubling for backward compatibility
but add some configuration switch (like play.evolutions.smartStatementParsing = true)
that turns on the smart statements separator aware of comments/string literals.

Right now the whole statements parsing is an one-line expression. I want to create a bit more sophisticated parser that however aids user experience as described above. Is it worth efforts / is it a valuable feature?

People keep hitting this issue https://github.com/playframework/playframework/issues/8326