C# Class Simple.Migrator.Framework.Migration

A migration is a group of transformation applied to the database schema (or sometimes data) to port the database from one version to another. The Up() method must apply the modifications (eg.: create a table) and the Down() method must revert, or rollback the modifications (eg.: delete a table).

Each migration must be decorated with the [Migration(0)] attribute. Each migration number (0) must be unique, or else a DuplicatedVersionException will be trown.

All migrations are executed inside a transaction. If an exception is thrown, the transaction will be rolledback and transformations wont be applied.

It is best to keep a limited number of transformation inside a migration so you can easely move from one version of to another with fine grain modifications. You should give meaningful name to the migration class and prepend the migration number to the filename so they keep ordered, eg.: 002_CreateTableTest.cs.

Use the Database property to apply transformation and the Logger property to output informations in the console (or other). For more details on transformations see ITransformationProvider.

Inheritance: IMigration
Afficher le fichier Open project: juanplopes/simple

Méthodes publiques

Méthode Description
AfterDown ( ) : void

This is run after the Down transaction has been committed

AfterUp ( ) : void

This is run after the Up transaction has been committed

Down ( ) : void

Defines transformations to revert things done in Up.

InitializeOnce ( string args ) : void

This gets called once on the first migration object.

Up ( ) : void

Defines tranformations to port the database to the current version.

Method Details

AfterDown() public méthode

This is run after the Down transaction has been committed
public AfterDown ( ) : void
Résultat void

AfterUp() public méthode

This is run after the Up transaction has been committed
public AfterUp ( ) : void
Résultat void

Down() public abstract méthode

Defines transformations to revert things done in Up.
public abstract Down ( ) : void
Résultat void

InitializeOnce() public méthode

This gets called once on the first migration object.
public InitializeOnce ( string args ) : void
args string
Résultat void

Up() public abstract méthode

Defines tranformations to port the database to the current version.
public abstract Up ( ) : void
Résultat void