Closed budiljak closed 8 months ago
Hi @budiljak, this issue has been fixed by https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1126 and is in release v7.0.5.0
Thanks for your efforts! :-)
Hi @aidanharan,
unfortunately it seems like there's new bugs when retrieving the default values. If the default for a datetime column is added by a constraint statement the default is falsely retrieved as "1970-1-1 00:00:00".
The error occurs if the NULL-Default is added like this:
ALTER TABLE [dbo].[XXX] ADD CONSTRAINT [DEFULT_FOR_TEST] DEFAULT (NULL) FOR [test];
And: I have one string column without any default for which the default is retrieved as "0".
:-(
Hi @budiljak, would you be able to open a new issue about the date issue and include a script to reproduce it? I had a look and wasn't able to recreate it.
Issue
When using a view pointing to a string column, the sqlserver-adapter doesn't retrieve the default value. Instead the value is nil. This leads to a ActiveRecord::NotNullViolation if the record is saved without explicitly assigning a value to the corresponding attribute.
7.0.4
7.0.4
2.1.5
Script to reproduce the bug: