Skip to content

Commit 9d479db

Browse files
committed
replace change_table with add_column in migration
I was running into a `TypeError: can't quote Array (TypeError)` error when running this migration and at first I thought using `change_table` instead of `add_column` seemed to help. In actuality the error still occurs when this migration is run as part of a sequence of multiple migrations, but the migration runs successfully when run on its own. However, the issue seems to be fixed in Rails 7.1 so: - can switch this to use `add_column` which is clearer in terms of the intent, and - wait until our Rails 7.1 upgrade is merged before shipping this
1 parent 42c7c77 commit 9d479db

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
class AddDietaryRestrictionsToMembers < ActiveRecord::Migration[7.0]
22
def change
3-
change_table :members do |t|
4-
t.enum :dietary_restrictions, enum_type: "dietary_restriction_enum", array: true, default: []
5-
end
3+
add_column :members, :dietary_restrictions, :enum, enum_type: "dietary_restriction_enum", array: true, default: []
64
add_column :members, :other_dietary_restrictions, :string
75
end
86
end

0 commit comments

Comments
 (0)