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
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.
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.
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
The text was updated successfully, but these errors were encountered: