Skip to content

Commit

Permalink
unitsOfLength migration
Browse files Browse the repository at this point in the history
  • Loading branch information
spencern committed Oct 7, 2017
1 parent 901325c commit fedf54c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Migrations } from "meteor/percolate:migrations";
import { Shops } from "/lib/collections";

Migrations.add({
// Initializes shops without a baseUOL and without unitsOfLength to our default
version: 17,
up() {
Shops.update({
baseUOL: { $exists: false },
unitsOfLength: { $exists: false }
}, {
$set: {
baseUOL: "in",
unitsOfLength: [{
uol: "in",
label: "Inches",
default: true
}, {
uol: "cm",
label: "Centimeters"
}, {
uol: "ft",
label: "Feet"
}]
}
}, { multi: true });
},
down() {
Shops.update({
baseUOL: { $exists: true },
unitsOfLength: { $exists: true }
}, {
$unset: {
baseUOL: "",
unitsOfLength: ""
}
}, { multi: true });
}
});
1 change: 1 addition & 0 deletions imports/plugins/core/versions/server/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ import "./13_add_shopId_on_shipping";
import "./14_rebuild_order_search_collection";
import "./15_update_shipping_status_to_workflow";
import "./16_update_billing_paymentMethod";
import "./17_set_shop_uols";

0 comments on commit fedf54c

Please sign in to comment.