From cd04bcc4b4e4f5174d2f042bfcf6b840e6e18fee Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 2 May 2021 20:28:53 -0400 Subject: Add Characters --- db/migrate/20210503002720_create_characters.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 db/migrate/20210503002720_create_characters.rb (limited to 'db/migrate') 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 -- cgit v1.2.3