volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

HStore: undefined: types #483

Closed toyo-iacob closed 5 years ago

toyo-iacob commented 5 years ago

What version of SQLBoiler are you using (sqlboiler --version)?

SQLBoiler v3.1.0

If this happened at runtime what code produced the issue? (if not applicable leave blank)

go generate && go build and in my main.go file i have the following: go:generate sqlboiler --wipe --no-tests --no-context --add-global-variants --config /path/to/config psql

Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)

CREATE TABLE product ( id SERIAL PRIMARY KEY NOT null, type_id integer not null REFERENCES product_type(id), parent_id integer not null REFERENCES product_parent(id), title character varying NOT NULL, short_description character varying NOT NULL, sku character varying(16) NOT NULL, attributes hstore,

created_at timestamp with time zone NOT NULL default current_timestamp,
updated_at timestamp with time zone NOT NULL default current_timestamp,
updated_by character varying not null

)

Further information. What did you do, what did you expect?

Hello,

One of my tables includes a hstore column. Go generate works fine, but the generated files do not include the types library ("github.com/volatiletech/sqlboiler/types") so GO doesn't know how to handle the data type. Adding it manually to the generated file fixes the problem but it's not a solution. I am using Postgres. What am i missing ? Are there any extra flags i need to add to the generate command in order to include types ? Removing any of the current flags is not fixing the issue.

P.S. I really appreciate the library and i use it often. It's just sometimes difficult to find answers or examples. Thanks in advance

aarondl commented 5 years ago

I've pushed a fix for this to dev.