Fix SQLite3 warning

Before setting this option, our test suite was giving the following warning:

```
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 $PATH/devise/test/rails_app/app/active_record/user.rb:5)
```

After configuring `represent_boolean_as_integer = true` as specified
above, we don't have this warning anymore.

More info:
https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SQLite3Adapter.html#method-c-represent_boolean_as_integer
This commit is contained in:
Felipe Renan 2019-01-25 17:01:28 -02:00
parent 369ba267ef
commit 45438fcfc4
1 changed files with 5 additions and 0 deletions

View File

@ -44,5 +44,10 @@ module RailsApp
config.to_prepare do
Devise::SessionsController.layout "application"
end
# Remove this check once Rails 5.0 support is removed.
if Devise::Test.rails52_and_up?
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
end
end
end