blob: 1420a0bc67898ffe4016b298016305bdb1a22a7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class CreateCharacters < ActiveRecord::Migration[6.1]
def change
create_table :characters do |t|
t.string :name
t.references :user, null: false, foreign_key: true
t.references :activity, foreign_key: true
t.timestamp :activity_started_at
t.timestamp :recent_request_at
t.timestamps
end
add_reference :users, :active_character, foreign_key: { to_table: :characters }
end
end
|