Made proficiencies their own objects, added migration functionality
This commit is contained in:
31
rpg-docs/server/migrations/migrations.js
Normal file
31
rpg-docs/server/migrations/migrations.js
Normal file
@@ -0,0 +1,31 @@
|
||||
Migrations.add({
|
||||
version: 1,
|
||||
up: function() {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 2,
|
||||
name: "converts effect proficiencies to proficiency objects",
|
||||
up: function() {
|
||||
Effects.find({operation: "proficiency"}).forEach(function(effect){
|
||||
var type;
|
||||
if(_.contains(SKILLS, effect.stat)) type = "skill";
|
||||
if(_.contains(SAVES, effect.stat)) type = "save";
|
||||
if(!type) throw "stat not a skill or a save";
|
||||
Proficiencies.insert({
|
||||
charId: effect.charId,
|
||||
name: effect.stat,
|
||||
value: effect.value,
|
||||
parent: effect.parent,
|
||||
type: type,
|
||||
enabled: effect.enabled
|
||||
});
|
||||
Effects.remove(effect._id);
|
||||
});
|
||||
},
|
||||
down: function(){
|
||||
return;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user