Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Meteor Migration Proposal
Post = new SimpleSchema({
version: 1,
title: {
type: String,
label: "Title",
max: 200
}
});
Migrations.add({
from_version: 1,
to_version: 2,
name: 'Adds "(oldpost) to every title',
up: function() {
to=from;
to.title = from.title + "(oldpost)";
}
down: function() {
from=to;
//asuming the from object is what we want as the result
from.title = to.title.replace("(oldpost)", "");
}
});
Post = new SimpleSchema({
version: 2,
title: {
type: String,
label: "Title",
max: 200
}
});
Migrations.add({
from_version: 2,
to_version: 3,
name: 'The boss told me the title of the post should be called "name"...',
up: function() {
to=from;
to.name = from.title;
delete to.title;
}
down: function() {
from=to;
//asuming the from object is what we want as the result
from.title = to.name;
delete from.name;
}
});
Post = new SimpleSchema({
version: 3,
name: {
type: String,
label: "Name",
max: 200
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment