Retrospring/db/migrate/20211219153054_create_profi...

24 lines
568 B
Ruby
Raw Normal View History

2021-12-19 07:51:04 -08:00
class CreateProfiles < ActiveRecord::Migration[5.2]
def change
create_table :profiles do |t|
t.references :user, index: true, foreign_key: true
t.string :display_name, length: 32
t.string :description, length: 256
t.string :location, length: 72
t.string :website
t.timestamps
end
User.find_each do |user|
Profile.create!(
user_id: user.id,
display_name: user.display_name,
description: user.bio,
location: user.location,
website: user.website,
)
end
end
end