Skip to content

Commit

Permalink
Fixed migration of attack data
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaumRystra committed May 19, 2015
1 parent f455cea commit ef44f6c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions rpg-docs/server/migrations/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,22 @@ Migrations.add({
up: function() {
//update attacks
Attacks.find({}).forEach(function(attack) {
var newDamage = attack.damageDice +
" + {" + attack.damageBonus + "}";
Attacks.update(
attack._id,
{
$unset: {
damageBonus: "",
damageDice: "",
if (!attack.damage && attack.damageDice && attack.damageBonus){
var newDamage = attack.damageDice +
" + {" + attack.damageBonus + "}";
Attacks.update(
attack._id,
{
$unset: {
damageBonus: "",
damageDice: "",
},
$set: {
damage: newDamage
},
},
$set: {
damage: newDamage
},
},
{validate: false});
{validate: false});
}
});
//update Items
Items.update(
Expand Down

0 comments on commit ef44f6c

Please sign in to comment.