Closed snex closed 16 hours ago
Seems to be happening for all column types, not just BIT.
Could you create a test-case using the script in https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/How-to-report-a-bug#minimal-reproducible-script and attach it to this issue?
It looks like this is a permissions problem - the user we are connecting with does not have proper view permissions on the table. It can see most of the table structure but not what the defaults should be, so the adapter is confused into thinking there are none. I think this should be safe to close. Thank you.
Issue
Default BIT columns are not being set
Expected behavior
If a column has a NOT NULL constraint and a default value is specified, then that default value should be used if the value was not set via the Rails model.
Actual behavior
NULL is being sent for the value, causing the database to throw an error and not create the record.
How to reproduce
Create a table with a column of type BIT with NOT NULL and a DEFAULT. Create a Rails model representing this table. Try to create a record without specifying the value for the column in question.
Details
7.1.3.2
7.1.3
2.1.7