diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20210706000053_add_location_to_character.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20210706000053_add_location_to_character.rb b/db/migrate/20210706000053_add_location_to_character.rb new file mode 100644 index 0000000..ec71ee8 --- /dev/null +++ b/db/migrate/20210706000053_add_location_to_character.rb @@ -0,0 +1,9 @@ +class AddLocationToCharacter < ActiveRecord::Migration[6.1] + def change + add_reference :characters, :location, foreign_key: true + Character.all.each do |character| + character.update(location_id: Location.find_by_gid("floret").id) + end + change_column :characters, :location_id, :bigint, null: false + end +end |