From 1916bafca04a30708343825fca4f0f13dc3b5c4d Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Wed, 22 Mar 2023 11:40:20 -0300 Subject: [PATCH] FIX: Remove `null: false` from dropped column (#24) * FIX: Remove `null: false` from dropped column It's causing an issue when attempting to seed data in fresh installs. The column was dropped in a post-migration. * Update db/migrate/20230322142028_make_dropped_value_column_nullable.rb Co-authored-by: David Taylor --------- Co-authored-by: David Taylor --- ...322142028_make_dropped_value_column_nullable.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 db/migrate/20230322142028_make_dropped_value_column_nullable.rb diff --git a/db/migrate/20230322142028_make_dropped_value_column_nullable.rb b/db/migrate/20230322142028_make_dropped_value_column_nullable.rb new file mode 100644 index 00000000..988e618d --- /dev/null +++ b/db/migrate/20230322142028_make_dropped_value_column_nullable.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +class MakeDroppedValueColumnNullable < ActiveRecord::Migration[7.0] + def up + if column_exists?(:completion_prompts, :value) + Migration::SafeMigrate.disable! + change_column_null :completion_prompts, :value, true + Migration::SafeMigrate.enable! + end + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end