Changing Play Evolutions SQL comment syntax - thoughts?

38 views
Skip to first unread message

Ryan Peters

unread,
Sep 30, 2017, 6:25:21 PM9/30/17
to Play framework dev
Hello Play developers,

I recently started using Play and wrote a SQL script for Evolutions with the "!Ups" and "!Downs" parts commented out, but I was surprised to see they were not recognized by Play. I did some research and I realized that they expected comments beginning with "#" instead of "--". In the DBs I'm used to, their dialect of SQL only uses standard SQL comment syntax, which is prefixed with "--" and not "#" (like MySQL, according to a Google search). Furthermore, when writing SQL in a non-MySQL dialect (PostgreSQL, Oracle, SQL, etc.), many editors will show the lines beginning with "#" as syntax errors, which could also have an affect on linting and automated code review.

I would like to propose an alternative syntax for Play Evolutions to rectify this. In particular, these would need to be the changes going forward:
  • Generated evolutions files should use "--" instead of "#" to delimit comments, to be more standards-compliant
  • More liberal regex definitions to accept "#", "--", and possibly even single-line "/* */"-style comment syntax

This way, going forward Play Evolutions will default to a more "standard" single-line comment style and be slightly more liberal in the comment styles it accepts for hand-written evolutions.


Anyway, I would be happy to write a PR myself and submit it for review. I thought I'd ask first and see what people think of the idea before I go ahead. Would a change like this work for Play as it is?


Sincerely,

Ryan Peters, hopeful contributor

Ryan Peters

unread,
Oct 2, 2017, 4:59:21 PM10/2/17
to Play framework dev
I have created a new pull request with the following changes:
  • Support for SQL92-style comment syntax using double-dash (--), single-line comments
  • Replaced all instances of MySQL comments in generated evolutions, etc. with SQL92-style
  • Updates to tests and documentation where necessary

I hope the changes can be accepted into Play as they would certainly make my life a little easier. Feel free to discuss here or in the PR.


Sincerely,

Ryan Peters

Reply all
Reply to author
Forward
0 new messages