Skip to content

Instantly share code, notes, and snippets.

@Batistleman
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Batistleman/824905c931052fb4ec2e to your computer and use it in GitHub Desktop.
Save Batistleman/824905c931052fb4ec2e to your computer and use it in GitHub Desktop.
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