You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/onyx-sql/query/set.cr
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,14 @@ module Onyx::SQL
56
56
raise"Cannot find an instance variable named @#{key} in #{T}"unless ivar
57
57
58
58
not_null = (a = ivar.annotation(Field) || ivar.annotation(Reference)) && a[:not_null]
59
+
59
60
raise"On Query(#{T})#set: #{key} is nilable in compilation time (`#{value}`), but #{T}@#{ivar.name} has `not_null` option set to `true`. Consider calling `.not_nil!` on the value"if not_null && value.nilable?
61
+
62
+
if (a = ivar.annotation(Reference)) && a[:foreign_key]
63
+
raise<<-TEXT
64
+
\e[41m Onyx::SQL compilation error \e[0m — Must not update \e[33m\e[1mUser@foo\e[0m in a query, because it's a foreign reference
0 commit comments