Tuesday, August 2, 2011

"Slash n" in db migrations scripts in Grails

If it is needed to print \n from migration script, it is needed to write 4 slashes before n (1, 2 or 3 will just print new line symbol), so it should look something like:

  changeSet(author: "user", id: "1") {
    insert(tableName: "table") {
      column (name:'column', value:'''aaaa\\\\nbbbb''')
    }
  }


will result in value being -

aaaa\nbbbb

No comments:

Post a Comment