diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20210503002720_create_characters.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20210503002720_create_characters.rb b/db/migrate/20210503002720_create_characters.rb new file mode 100644 index 0000000..1420a0b --- /dev/null +++ b/db/migrate/20210503002720_create_characters.rb @@ -0,0 +1,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 |