uclibs / ucrate

Scholar@UC: University of Cincinnati's self-submission institutional repository
https://scholar.uc.edu
Other
5 stars 3 forks source link

Deprecation Warning : sqlite3_adapter.rb #985

Open scherztc opened 2 years ago

scherztc commented 2 years ago

/Users/scherztc/.rvm/gems/ruby-2.7.5@ucrate/gems/activerecord-5.2.4.6/lib/active_record/connection_adapters/sqlite3_adapter.rb:32: warning: rb_check_safe_obj will be removed in Ruby 3.0

How to replicate : bundle exec rake db:migrate

Done looks like : There are no warnings when running db:migrate.

DEPRECATION WARNING: Leaving ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer set to false is deprecated. SQLite databases have used 't' and 'f' to serialize boolean values and must have old data converted to 1 and 0 (its native boolean serialization) before setting this flag to true. Conversion can be accomplished by setting up a rake task which runs

ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1) ExampleModel.where("boolean_column = 'f'").update_all(boolean_column: 0)

for all models and all boolean columns, after which the flag must be set to true by adding the following to your application.rb file:

Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true (called from <top (required)> at /Users/scherztc/Workspaces/ucrate/config/environment.rb:7)

Janell-Huyck commented 11 months ago

The fix for this issue is in 2 separate PR's. The first, PR #1123, creates a rake task for the developers to run locally to prepare their local sqlite databases for the update. The second, PR #1124, modifies the application.rb file to prevent future saving of data in the deprecated format. All developers need to run the rake tasks from #1123 before they attempt to run the app with the configuration change in #1124.