From 44facc2e567eb3c045ce082428f42276e45b0202 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sat, 22 May 2021 18:10:19 -0400 Subject: Monsters and basic combat --- db/migrate/20210522194937_add_wounds_to_characters.rb | 5 +++++ db/migrate/20210522201259_create_monsters.rb | 12 ++++++++++++ db/schema.rb | 12 +++++++++++- db/seeds.rb | 5 +++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20210522194937_add_wounds_to_characters.rb create mode 100644 db/migrate/20210522201259_create_monsters.rb (limited to 'db') diff --git a/db/migrate/20210522194937_add_wounds_to_characters.rb b/db/migrate/20210522194937_add_wounds_to_characters.rb new file mode 100644 index 0000000..be56e29 --- /dev/null +++ b/db/migrate/20210522194937_add_wounds_to_characters.rb @@ -0,0 +1,5 @@ +class AddWoundsToCharacters < ActiveRecord::Migration[6.1] + def change + add_column :characters, :wounds, :integer + end +end diff --git a/db/migrate/20210522201259_create_monsters.rb b/db/migrate/20210522201259_create_monsters.rb new file mode 100644 index 0000000..39f0a1a --- /dev/null +++ b/db/migrate/20210522201259_create_monsters.rb @@ -0,0 +1,12 @@ +class CreateMonsters < ActiveRecord::Migration[6.1] + def change + create_table :monsters do |t| + t.string :gid + t.string :name + t.text :description + t.jsonb :whatnot + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 5649a54..6dfbe87 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_05_22_184444) do +ActiveRecord::Schema.define(version: 2021_05_22_201259) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -67,6 +67,7 @@ ActiveRecord::Schema.define(version: 2021_05_22_184444) do t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.bigint "active_title_id" + t.integer "wounds" t.index ["active_title_id"], name: "index_characters_on_active_title_id" t.index ["activity_id"], name: "index_characters_on_activity_id" t.index ["user_id"], name: "index_characters_on_user_id" @@ -149,6 +150,15 @@ ActiveRecord::Schema.define(version: 2021_05_22_184444) do t.index ["gid"], name: "index_locations_on_gid" end + create_table "monsters", force: :cascade do |t| + t.string "gid" + t.string "name" + t.text "description" + t.jsonb "whatnot" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "skills", force: :cascade do |t| t.string "gid" t.string "name" diff --git a/db/seeds.rb b/db/seeds.rb index ca72f1e..5a6c696 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -49,3 +49,8 @@ load_data_file("data/hearth_amenities.yml").map do |gid, hash| hearth_amenity = HearthAmenity.find_or_create_by(gid: gid) hearth_amenity.update(hash) end + +load_data_file("data/monsters.yml").map do |gid, hash| + monster = Monster.find_or_create_by(gid: gid) + monster.update(hash) +end -- cgit v1.2.3