build_stubbed does not fill id for uuid column type with SQLServer
vividmuimui opened this issue · 0 comments
Description
When using SQLServer and 'uuid' as the primary key type, they 'build_stubbed' method does not automatically fill the id column. I would assume that this is filled independent of the column type.
factory_bot/lib/factory_bot/strategy/stub.rb
Lines 91 to 96 in 0521d91
I'm thinking the code here is the problem.
In SQLServer, the column.sql_type
seems to be "uniqueidentifier"
.
I think it might work if I use column.type
, but I don't know if this is a problem in other databases, so I've raised an issue.
Reproduction Steps
Sample code → https://github.com/vividmuimui/sqlserver-factorybot/commits/main/
Expected behavior
When you use build_stubbed, the primary key is always set. Also if you use the uuid type.
Actual behavior
The id of the generated instance is nil.
System configuration
factory_bot version: 6.4.5
rails version: 7.1.3
ruby version: v3.3.0