summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-07 20:25:56 -0400
committerDavid Gay <david@davidgay.org>2021-06-07 20:25:56 -0400
commitbafe2ca25dcb347bc00cbae5cb82d5658a92ec4f (patch)
treedb260c9d503fe7071183ece7fdb7fdcef118fe9e /db/migrate
parent54473e0e8d2db24e4c1dd12aa309d610e62ed09d (diff)
Record and reference MonsterSpawn starting HP in the database
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20210608001838_add_starting_hp_to_monster_spawns.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/db/migrate/20210608001838_add_starting_hp_to_monster_spawns.rb b/db/migrate/20210608001838_add_starting_hp_to_monster_spawns.rb
new file mode 100644
index 0000000..4b89120
--- /dev/null
+++ b/db/migrate/20210608001838_add_starting_hp_to_monster_spawns.rb
@@ -0,0 +1,8 @@
+class AddStartingHpToMonsterSpawns < ActiveRecord::Migration[6.1]
+ def change
+ add_column :monster_spawns, :starting_hp, :integer
+ MonsterSpawn.all.each do |ms|
+ ms.update(starting_hp: ms.monster.max_hp)
+ end
+ end
+end