'Rails DB in production change: better to reload schema or to alter the table?

I have a rails app deployed in production and changed a few "boolean" columns to have a default of "false" and to be "not null". In the dev environment, I simply run a migration, but what is the suggested procedure for a db in production (only a handful of users): reload the schema (rails db:schema:load) or to alter the table directly eg via phpmyadmin?



Solution 1:[1]

The whole point of migrations is that it provides a DSL that makes it easier to perform database transformations in a repeatible way across all your environments so that you maintain parity and being able to actually test the steps in development/test greatly reduces the risk of mishaps due to simple human error.

Use the migrations Luke.

rails db:schema:load is only intended to be used when you're setting up a database up from scratch. This would be for example if you're setting a new machine up for development or during testing/CI to ensure a blank slate. Your users probably won't appreciate if you wipe their data.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1