So I figured that I can edit the deserialized HBM mappings that ByCode creates and update the mappings manually.
var mapping = ModelMapper.CompileMappingFor(entityTypes);
// HACK: by code mapping doesn't support setting precision and scale, so fix flake ID columns here
var flakeTypeName = typeof (RustFlakeGenerator).AssemblyQualifiedName;
foreach (var id in (from root in mapping.RootClasses
where root.Id.Type.name == "Decimal" && root.Id.generator.@class == flakeTypeName
select root.Id))
{
var column = id.column == null || !id.column.Any() ? new HbmColumn() : id.column.First();
column.name = id.name;
column.precision = "28";
column.scale = "0";
if (id.column == null || !id.column.Any()) id.column = new[] {column};
}
It sucks, and SchemaExport et al totally ignore the precision and scale (defaulting to decimal(19,5)
, but I only use that for scaffolding and can just fix that manually), but it works.