Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UInt32 mysql column error #409

Open
dmatamoroscr opened this issue Jul 1, 2022 · 2 comments
Open

UInt32 mysql column error #409

dmatamoroscr opened this issue Jul 1, 2022 · 2 comments

Comments

@dmatamoroscr
Copy link

I'm getting this error when I try to set a column as an UInt32 with null: false
(using it in amber framework with mysql adapter, all in latest versions)

03:13:29 watch.run (Info) Building...
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'base_mapping'

Code in macro 'draw_mapping'

 3 | base_mapping(true)
     ^
Called macro defined in lib/jennifer/src/jennifer/model/mapping.cr:206:7

 206 | macro base_mapping(strict = true)

Which expanded to:

 > 505 |
 > 506 |               begin
 > 507 |                 __temp_221.as(UInt32)
                         ^
Error: can't cast Nil to UInt32

Relevant model mapping:

  mapping(
    id: Primary32,
    from_ip_num: {type: UInt32, null: false},
    to_ip_num: {type: UInt32, null: false},
  )
@imdrasil
Copy link
Owner

imdrasil commented Jul 9, 2022

I hope you've already found the root cause but otherwise here is my thought. Likrly the reason is that you pass nil to one of your UInt32 field. Unfortunately because of the dynamic nature of mapping system compilation errors may be not very obvious. Please use --error-trace for full log so it'll be easier to debug

@imdrasil
Copy link
Owner

imdrasil commented Nov 6, 2022

@dmatamoroscr do you still need any assistance with your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants