File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
lib/active_record/connection_adapters Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 88- [ #874 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/874 ) Deduplicate schema cache structures
99- [ #875 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/875 ) Handle default boolean column values when deduplicating
1010- [ #879 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/879 ) Added visit method for HomogeneousIn
11+ - [ #880 ] ( https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/880 ) Handle any default column class when deduplicating
1112
1213#### Changed
1314
Original file line number Diff line number Diff line change @@ -30,13 +30,14 @@ def case_sensitive?
3030
3131 private
3232
33- # Handle when the default value is a boolean. Boolean's do not respond to the method `:-@`. Method now
34- # checks whether the default value is already frozen and if so it uses that, otherwise it calls `:-@` to
35- # freeze it.
33+ # In the Rails version of this method there is an assumption that the `default` value will always be a
34+ # `String` class, which must be true for the MySQL/PostgreSQL/SQLite adapters. However, in the SQL Server
35+ # adapter the `default` value can also be Boolean/Date/Time/etc. Changed the implementation of this method
36+ # to handle non-String `default` objects.
3637 def deduplicated
3738 @name = -name
3839 @sql_type_metadata = sql_type_metadata . deduplicate if sql_type_metadata
39- @default = ( default . frozen? ? default : - default ) if default
40+ @default = ( default . is_a? ( String ) ? - default : default . dup . freeze ) if default
4041 @default_function = -default_function if default_function
4142 @collation = -collation if collation
4243 @comment = -comment if comment
You can’t perform that action at this time.
0 commit comments