diff options
author | David Gay <david@davidgay.org> | 2021-05-02 20:28:53 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-02 20:40:37 -0400 |
commit | cd04bcc4b4e4f5174d2f042bfcf6b840e6e18fee (patch) | |
tree | 30f869867ff5b120255febe3db47dacd28f432f0 /db/migrate | |
parent | 2b32a88a8e9f1d0bb5055843ac987d9cb9981803 (diff) |
Add Characters
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 |