Skip to content

Commit

Permalink
Reset migrations to line up with current DiceCloud server
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaumRystra committed Jul 13, 2017
1 parent 54f055d commit 35b6fe2
Showing 1 changed file with 0 additions and 130 deletions.
130 changes: 0 additions & 130 deletions rpg-docs/server/migrations/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,136 +23,6 @@ Meteor.methods({

Migrations.add({
version: 1,
name: "converts effect proficiencies to proficiency objects, removes types from assets",
up: function() {
//convert proficiency effects to proficiency objects
Effects.find({operation: "proficiency"}).forEach(function(effect){
var type = "skill";
if (_.contains(SAVES, effect.stat)) type = "save";
Proficiencies.insert({
charId: effect.charId,
name: effect.stat,
value: effect.value,
parent: _.clone(effect.parent),
type: type,
enabled: effect.enabled,
}, function(err){
if (!err) 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}
);
},
});

Migrations.add({
version: 2,
name: "Converts attacks from damage dice and damage bonus to a string with curly bracket calculations, adds settings.showIncrement to items",
up: function() {
//update attacks
Attacks.find({}).forEach(function(attack) {
if (!attack.damage && attack.damageDice && attack.damageBonus){
var newDamage = attack.damageDice +
" + {" + attack.damageBonus + "}";
Attacks.update(
attack._id,
{
$unset: {
damageBonus: "",
damageDice: "",
},
$set: {
damage: newDamage
},
},
{validate: false});
}
});
//update Items
Items.update(
{settings: undefined},
{$set: {"settings.showIncrement" : false}},
{validate: false, multi: true}
);
},
});

Migrations.add({
version: 3,
name: "Converts attacks from damage dice and damage bonus to a string with curly bracket calculations, adds settings.showIncrement to items",
up: function() {
//update characters
Characters.update(
{"settings.useVariantEncumbrance": undefined},
{$set: {"settings.useVariantEncumbrance" : false}},
{validate: false, multi: true}
);
Characters.update(
{"settings.useStandardEncumbrance": undefined},
{$set: {"settings.useStandardEncumbrance" : true}},
{validate: false, multi: true}
);
},
});

Migrations.add({
version: 4,
name: "Adds an effect to give characters a base carry capacity",
up: function() {
//update characters

Characters.find({}).forEach(function(char){
Characters.update(char._id, {
$set: {
carryMultiplier: {
adjustment: 0,
reset: "longRest",
}
}
});
var effect = Effects.findOne({
charId: char._id, name: "Natural Carrying Capacity",
});
if (effect) return;
Effects.insert({
charId: char._id,
name: "Natural Carrying Capacity",
stat: "carryMultiplier",
operation: "base",
value: "1",
parent: {
id: char._id,
collection: "Characters",
group: "Inate",
},
});
effect = Effects.findOne({
charId: char._id, name: "Natural Carrying Capacity",
});
if (!effect) throw "Carry capacity effect should be set by now."
});
},
down: function(){
return;
},
});

Migrations.add({
version: 5,
name: "Gives all characters a URL name",
up: function() {
//update characters
Expand Down

0 comments on commit 35b6fe2

Please sign in to comment.