-
Notifications
You must be signed in to change notification settings - Fork 4
Concepts
sklose edited this page Jan 3, 2011
·
2 revisions
A migration is an operation that transforms the database from one state to another. Each migration has two methods: "Up" and "Down". The first one applies the changes of the migrations to your database, the second method is responsible for undoing all changes.
To make migrations work it's necessary to give each migration a unique ID. NMigrations will execute your migrations according to these IDs. You may use version numbers or timestamps for these IDs - however timestamps are recommended since the same version number may be used by different developers who are writing migrations concurrently which results in a conflict.
[Migration(2009, 11, 11, 9, 42, 0)]
public class InitialMigration : IMigration
{
public void Up(Database db)
{
}
public void Down(Database db)
{
}
}
The example shows a migration that uses a timestamp for versioning.