Mysql table with unsigned primary key atribute wrongly maped to int insted of uint in ActiveRecord.cs
Closed this issue · 3 comments
I have this table:
CREATE TABLE ceger_dev
.eo_crawler_shops
(
ID
int(10) unsigned NOT NULL auto_increment,
ShopName
varchar(128) NOT NULL,
NextCrawl
datetime NOT NULL COMMENT 'setuje se kad se zavrsi crawl',
CrawlInProgress
tinyint(1) NOT NULL default '0',
LastCrawl
datetime default NULL COMMENT 'setuje se kad krene crawl',
PRIMARY KEY (ID
),
UNIQUE KEY Index_ShopName
(ShopName
)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
ID is unsigned but code generated for it is :
int _id;
public int id
{
get { return _id; }
set
{
if(_id!=value){
_id=value;
var col=tbl.Columns.SingleOrDefault(x=>x.Name=="id");
if(col!=null){
if(!_dirtyColumns.Any(x=>x.Name==col.Name) && _isLoaded){
_dirtyColumns.Add(col);
}
}
OnChanged();
}
}
}
it should be uint.
When I change it manually to uint it works.
There's no way to tell (that I can see) if a value is signed/unsigned in our templates. If you'd like to help out and investigate for us that would rock - other than that I'm not sure what we can do just yet.
I've just put the bug fixed for MySQL unsigned data type, you can check my subsonic3 template fork while I'm sending the bug fixed to rob.
nice. I will wait until it is merged. I hope it works...