C# 클래스 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.

상속: IMigration
파일 보기 프로젝트 열기: juanplopes/simple

공개 메소드들

메소드 설명
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.

메소드 상세

AfterDown() 공개 메소드

This is run after the Down transaction has been committed
public AfterDown ( ) : void
리턴 void

AfterUp() 공개 메소드

This is run after the Up transaction has been committed
public AfterUp ( ) : void
리턴 void

Down() 공개 추상적인 메소드

Defines transformations to revert things done in Up.
public abstract Down ( ) : void
리턴 void

InitializeOnce() 공개 메소드

This gets called once on the first migration object.
public InitializeOnce ( string args ) : void
args string
리턴 void

Up() 공개 추상적인 메소드

Defines tranformations to port the database to the current version.
public abstract Up ( ) : void
리턴 void