Replaced languages and proficiency strings with proper proficiencies
This commit is contained in:
@@ -1,31 +1,37 @@
|
||||
Migrations.add({
|
||||
version: 1,
|
||||
name: "converts effect proficiencies to proficiency objects, removes types from assets",
|
||||
up: function() {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 2,
|
||||
name: "converts effect proficiencies to proficiency objects",
|
||||
up: function() {
|
||||
//convert proficiency effects to proficiency objects
|
||||
Effects.find({operation: "proficiency"}).forEach(function(effect){
|
||||
var type;
|
||||
if(_.contains(SKILLS, effect.stat)) type = "skill";
|
||||
var 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,
|
||||
parent: _.clone(effect.parent),
|
||||
type: type,
|
||||
enabled: effect.enabled
|
||||
}, function(err){
|
||||
if(!err) Effects.remove(effect._id);
|
||||
});
|
||||
Effects.remove(effect._id);
|
||||
});
|
||||
//store type as a parent group if it's needed
|
||||
Effects.find({"parent.collection": "Characters"}).forEach(function(e){
|
||||
Effects.update(e._id, {$set: {"parent.group": e.type}});
|
||||
});
|
||||
Attacks.find({"parent.collection": "Characters"}).forEach(function(a){
|
||||
Attacks.update(a._id, {$set: {"parent.group": a.type}});
|
||||
});
|
||||
//remove type
|
||||
Effects.update({}, {$unset: {type: ""}}, {validate: false, multi: true});
|
||||
Attacks.update({}, {$unset: {type: ""}}, {validate: false, multi: true});
|
||||
//remove languages and proficiencies
|
||||
Characters.update(
|
||||
{},
|
||||
{$unset: {languages: "", proficiencies: ""}},
|
||||
{validate: false, multi: true}
|
||||
);
|
||||
},
|
||||
down: function(){
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user