mdmoss / doobie-codegen

Generate Doobie database code from sql statements.
MIT License
10 stars 7 forks source link

Not able to generate code if add below statements. #57

Closed PiyushMishra closed 5 years ago

PiyushMishra commented 6 years ago

ALTER TABLE article owner TO someuser;

Getting error Invalid input 'o', expected [ \n\t], 'A' or 'D' (line 1, column 37):

COMMENT ON COLUMN artilce.id IS 'It is an auto increamented id';

Invalid input 'E', expected 'i' (line 1, column 5):

DpEpsilon commented 5 years ago

Hi @PiyushMishra,

Sorry this issue went unanswered for so long.

doobie-codegen does not keep track of all schema state, and so does not parse all valid statements. If you want doobie-codegen to ignore this section of SQL, please use the off/on directives as illustrated below:

-- doobie-codegen: off
ALTER TABLE article owner TO someuser;
-- doobie-codegen: on

doobie-codegen will ignore any lines of SQL between -- doobie-codegen: off and -- doobie-codegen: on