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
CREATETABLEitems
(
id INT AUTO_INCREMENT PRIMARY KEY,
type_id INTNOT NULL
price DECIMAL(10, 2) NULL,
type_name VARCHAR(255) NULL,
published TINYINT(1) NULL,
created_at TIMESTAMPNULL,
updated_at TIMESTAMPNULL,
)
item.cr
require"granite_orm/adapter/mysql"classItem < Granite::ORM::Base
adapter mysql
table_name items
field type_id : Int32
field type_name : String
field price : Float64
field published : Bool
timestamps
end
I, [2018-04-06 20:37:51 -04:00 #6427] INFO -- Granite: INSERT INTO `items` (`type_id`, `type_name`, `price`, `published`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?): [99, "Anshar", 99.0, true, "2018-04-07 00:37:51", "2018-04-07 00:37:51"]
I, [2018-04-06 20:37:51 -04:00 #6427] INFO -- Granite: SELECT `items`.`id`, `items`.`type_id`, `items`.`type_name`, `items`.`price`, `items`.`published`, `items`.`created_at`, `items`.`updated_at` FROM `items` WHERE `id`=? LIMIT 1: 1
MySql::ResultSet#read returned a Int32. A (Int64 | Nil) was expected. (Exception)
from lib/db/src/db/result_set.cr:0:9 in 'read'
from src/api2/models/item.cr:4:3 in 'set_attributes'
from src/api2/models/item.cr:4:3 in 'from_sql'
from lib/granite_orm/src/granite_orm/querying.cr:84:13 in 'find_by'
from lib/granite_orm/src/granite_orm/querying.cr:73:12 in 'find'
from src/api2.cr:29:1 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:11:3 in '_crystal_main'
from /usr/share/crystal/src/crystal/main.cr:112:5 in 'main_user_code'
from /usr/share/crystal/src/crystal/main.cr:101:7 in 'main'
from /usr/share/crystal/src/crystal/main.cr:135:3 in 'main'
from __libc_start_main
from _start
from ???
The text was updated successfully, but these errors were encountered:
Blacksmoke16
changed the title
Primary key not included in fields in querying.cr
MySql::ResultSet#read returned a Int32. A (Int64 | Nil) was expected. (Exception)
Apr 7, 2018
Happens on latest amberframework/granite version
Example table:
items
item.cr
app.cr
error
The text was updated successfully, but these errors were encountered: