Friday, May 19, 2017

CRLF will be replaced by LF in db/structure.sql.

$ git add db/structure.sql
warning: CRLF will be replaced by LF in db/structure.sql.
The file will have its original line endings in your working directory.

Thought we had all our line-ending nonsense straightened out, but could see that structure.sql before being updated by rake db:migrate just had \n and after had some \r\n:

$ file structure.sql.before_db_migrate
before.txt: ASCII text, with very long lines
$ file structure.sql.after_db_migrate 
after.txt: ASCII text, with very long lines, with CRLF, LF line terminators
$ cat -v structure.sql.after_db_migrate
...
CREATE FUNCTION some_function_name() RETURNS void
    LANGUAGE ...
    AS $$^M
BEGIN^M
  REFRESH ...;^M
  RETURN;^M
END; $$;

So, it was in a single function of the schema. Not Rails's/ActiveRecord's fault and not a git config problem.

No comments: