Closed gencer closed 6 years ago
Your problem is here: https://github.com/volatiletech/sqlboiler/blob/v3.0.0-rc9/randomize/random.go#L46
The issue is that satori.uuid made a breaking change to their API and you still have the older version of satori.uuid - in order to fix this problem upgrade your satori.uuid dependency. In the latest in the v3 branch (not tagged, but perfectly usable) we've actually removed the satori.uuid library for a properly maintained fork because of problems like this: https://github.com/satori/go.uuid/issues/73 so another fix for you could be just using the latest v3 branch.
@aarondl thanks for the prompt answer. v3
branch fixed my issue.
BTW, If you take above sample (gist) I have one more issue. No matter what I do Message table inserts ID
as 0
. It does not increment value. Always 0
. You can see model and schema in gist.
What I do is:
var p1 models.Message
uid := null.Int64{Int64: 1, Valid: true}
p1.UserID = uid
err := p1.Insert(db, boil.Infer())
Error: models: unable to insert into messages: pq: duplicate key value violates unique constraint "messages_pkey"
I think I've found the problem. PostgreSQL introduced GENERATE IDENTITY
feature in 10.2 to drop-in replacement for SERIAL
. When a table id
generated using an IDENTITY
it does not have a default value like SERIAL
has (which is: nextval('test_id_seq'::regclass)
).
Due to this, ID
is always 0
.
See #356
What version of SQLBoiler are you using (
sqlboiler --version
)?v3.0.0-rc9
If this happened at runtime what code produced the issue?
Tried:
sqlboiler psql --add-global-variants --no-context
andsqlboiler psql
both generates models butgo build / go run
fails in any waySchema (psql), Model and main() is attached here: https://gist.github.com/gencer/31d3a41f639ed34504036faa28c75b81
What I get?
Further information. What did you do, what did you expect?
v2 is just works. I upgraded to v3 and can't go one step further.