I have a problem with timestamps columns in join table:

[23] pry(main)> *Teacher*.last.add_category(*Category*.last)

I, [2021-01-06T19:07:55.807209 #13867]  INFO -- : (0.000301s) SELECT * FROM 
"teachers" ORDER BY "id" DESC LIMIT 1

I, [2021-01-06T19:07:55.807773 #13867]  INFO -- : (0.000180s) SELECT * FROM 
"categories" ORDER BY "id" DESC LIMIT 1

E, [2021-01-06T19:07:55.808669 #13867] ERROR -- : PG::NotNullViolation: 
ERROR:  null value in column "created_at" of relation "categories_teachers" 
violates not-null constraint

DETAIL:  Failing row contains (ffe8d90f-4961-4295-b36f-239be713f101, 
ff0747d6-9073-4b67-a0f1-e489f3b16431, null, null).: INSERT INTO 
"categories_teachers" ("teacher_id", "category_id") VALUES 
('ffe8d90f-4961-4295-b36f-239be713f101', 
'ff0747d6-9073-4b67-a0f1-e489f3b16431') RETURNING NULL

Sequel::NotNullConstraintViolation: PG::NotNullViolation: ERROR:  null 
value in column "created_at" of relation "categories_teachers" violates 
not-null constraint

DETAIL:  Failing row contains (ffe8d90f-4961-4295-b36f-239be713f101, 
ff0747d6-9073-4b67-a0f1-e489f3b16431, null, null).


from 
/Users/mateuszurbanski/.gem/ruby/3.0.0/gems/sequel-5.40.0/lib/sequel/adapters/postgres.rb:156:in
 
`exec'

Caused by PG::NotNullViolation: ERROR:  null value in column "created_at" 
of relation "categories_teachers" violates not-null constraint

DETAIL:  Failing row contains (ffe8d90f-4961-4295-b36f-239be713f101, 
ff0747d6-9073-4b67-a0f1-e489f3b16431, null, null).


from 
/Users/mateuszurbanski/.gem/ruby/3.0.0/gems/sequel-5.40.0/lib/sequel/adapters/postgres.rb:156:in
 
`exec'


In this gist there are details of implementation:

https://gist.github.com/MatUrbanski/fe7ad31807b29c86edd546de645b6d09

How can I fix that?

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/ece946fa-9ffe-403d-ab86-b488834e9238n%40googlegroups.com.

Reply via email to