uclibs / ucrate

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

985 - Add new rake task to convert boolean values #1123

Closed Janell-Huyck closed 7 months ago

Janell-Huyck commented 8 months ago

Ref #985

NOTE: These rake tasks need to be run on all local developers' computers before we merge in the related PR,

Rake Task for Boolean Value Conversion

Overview

We're addressing a deprecation warning in our application, originating from Rails 5.2.4.6, concerning the storage of boolean values in SQLite databases. This update is a proactive step towards our planned migration to Rails 6.0.

The Warning and Its Implications

In our current setup, boolean values in SQLite databases (used in our development and testing environments) are stored as 't' (true) and 'f' (false). However, Rails 6.0 expects these values to be stored as integers: 1 (true) and 0 (false). Although our current Rails version can work with 1/0, our SQLite databases predominantly use the 't'/'f' format.

Why This Update Is Necessary

Updating these values to 1/0 is crucial for compatibility with Rails 6.0. Without this change, we risk encountering boolean-related issues post-migration, as the new Rails version will not interpret 't'/'f' as boolean values.

Introducing the Rake Task

To facilitate this transition, we've developed a Rake task that converts all boolean fields from 't'/'f' to 1/0 in our SQLite databases. This task ensures a smooth upgrade path to Rails 6.0.

Running the Task: Detailed Instructions

To run this task in your local (development) and testing environments, use bundle exec to ensure the task executes within the context of our app's current bundle. Here are the commands for both environments:

Scope and Future Considerations

This task is specifically designed for SQLite databases and does not affect our MySQL environments (QA and production). Looking ahead, aligning our development and testing setups with QA and production by using MySQL might be beneficial for consistent environment management.

Conclusion

Implementing this update is a key part of ensuring our application remains compatible and stable with the upcoming Rails 6.0 upgrade. It reflects our commitment to maintaining a robust and up-to-date codebase.

Janell-Huyck commented 7 months ago

We decided not to go with this approach but rather have developers drop their local tables when we switch to Rails 6.