diff options
author | David Gay <david@davidgay.org> | 2021-06-06 17:57:43 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-06 17:57:43 -0400 |
commit | 3622126380278d9bed8ea0e1e05a0bd1ea040596 (patch) | |
tree | f34f85368138cc3038f362ac4c68a9d5756f55fc /db | |
parent | 387684c8be4691c4469677e48e1b0a46ad600363 (diff) |
Messages
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20210606214340_create_messages.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 15 |
2 files changed, 26 insertions, 1 deletions
diff --git a/db/migrate/20210606214340_create_messages.rb b/db/migrate/20210606214340_create_messages.rb new file mode 100644 index 0000000..5886af6 --- /dev/null +++ b/db/migrate/20210606214340_create_messages.rb @@ -0,0 +1,12 @@ +class CreateMessages < ActiveRecord::Migration[6.1] + def change + create_table :messages do |t| + t.references :sender, foreign_key: { to_table: :characters } + t.references :recipient, null: false, foreign_key: { to_table: :characters } + t.string :subject + t.text :body + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a41002..55a66d9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_06_05_223042) do +ActiveRecord::Schema.define(version: 2021_06_06_214340) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -185,6 +185,17 @@ ActiveRecord::Schema.define(version: 2021_06_05_223042) do t.index ["gid"], name: "index_locations_on_gid" end + create_table "messages", force: :cascade do |t| + t.bigint "sender_id" + t.bigint "recipient_id", null: false + t.string "subject" + t.text "body" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["recipient_id"], name: "index_messages_on_recipient_id" + t.index ["sender_id"], name: "index_messages_on_sender_id" + end + create_table "monsters", force: :cascade do |t| t.string "gid" t.string "name" @@ -279,6 +290,8 @@ ActiveRecord::Schema.define(version: 2021_06_05_223042) do add_foreign_key "hearths", "characters" add_foreign_key "learned_activities", "activities" add_foreign_key "learned_activities", "characters" + add_foreign_key "messages", "characters", column: "recipient_id" + add_foreign_key "messages", "characters", column: "sender_id" add_foreign_key "states", "characters" add_foreign_key "states", "conditions" add_foreign_key "title_awards", "characters" |