From b12815875922bf68da7c13b4d9926c6c3ffcd754 Mon Sep 17 00:00:00 2001 From: fatkodima Date: Sat, 10 Feb 2024 20:07:04 +0200 Subject: [PATCH] Improve `removing a column` docs --- README.md | 2 +- lib/online_migrations/error_messages.rb | 4 ++-- test/command_checker/removing_columns_test.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9c11e84..5d2ba89 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ end end ``` -4. Remove column ignoring from `User` model +4. Remove column ignoring from step 1 5. Deploy ### Adding a column with a default value diff --git a/lib/online_migrations/error_messages.rb b/lib/online_migrations/error_messages.rb index 8f66e14..3d272fc 100644 --- a/lib/online_migrations/error_messages.rb +++ b/lib/online_migrations/error_messages.rb @@ -295,7 +295,7 @@ def change Active Record caches database columns at runtime, so if you drop a column, it can cause exceptions until your app reboots. A safer approach is to: -1. Ignore the column(s): +1. Ignore the column: class <%= model %> < ApplicationRecord self.ignored_columns = <%= columns %> @@ -310,7 +310,7 @@ def change end end -4. Remove columns ignoring +4. Remove column ignoring from step 1 5. Deploy <% end %>", diff --git a/test/command_checker/removing_columns_test.rb b/test/command_checker/removing_columns_test.rb index b37cd5e..557844d 100644 --- a/test/command_checker/removing_columns_test.rb +++ b/test/command_checker/removing_columns_test.rb @@ -35,7 +35,7 @@ def test_remove_column Active Record caches database columns at runtime, so if you drop a column, it can cause exceptions until your app reboots. A safer approach is to: - 1. Ignore the column(s): + 1. Ignore the column: class User < ApplicationRecord self.ignored_columns = ["email"] @@ -50,7 +50,7 @@ def change end end - 4. Remove columns ignoring + 4. Remove column ignoring from step 1 5. Deploy MSG end