forked from fluentmigrator/fluentmigrator
-
Notifications
You must be signed in to change notification settings - Fork 1
Create custom metadata for the VersionInfo table
daniellee edited this page Dec 28, 2012
·
3 revisions
By implementing the IVersionTableMetaData interface you can change the defaults for the VersionInfo table. The interface exposes four properties:
- SchemaName (default is empty)
- TableName (default is VersionInfo)
- ColumnName (default is Version)
- UniqueIndexName (default is UC_Version)
In the same assembly that your migrations are located, create a new class (it has to be public) that implements the IVersionTableMetaData interface and decorate the class with the VersionTableMetaData attribute. FluentMigrator will automatically find this and use it instead of the default settings.
A common use case is changing the default schema so that you can have a migration assembly per schema.
using FluentMigrator.VersionTableInfo;
namespace Migrations
{
[VersionTableMetaData]
public class VersionTable : IVersionTableMetaData
{
public string ColumnName
{
get { return "Version"; }
}
public string SchemaName
{
get { return ""; }
}
public string TableName
{
get { return "Version2"; }
}
public string UniqueIndexName
{
get { return "UC_Version"; }
}
}
}
- Getting FluentMigrator
- How to create a Migration
- Fluent Interface
- Migration Runners
- Use inbuilt database functions when setting the default value
- Sql Server Specific Extensions
- Raw Sql Helper for inserting data
- Auto Reversing Migrations
- Resharper File Template
- Transaction Modes for the Migration Runner
- ApplicationContext: Passing parameters to Migrations
- Dealing with Multiple Database Types
- Filter migrations run based on Tags
- Enforce migration version numbering rules
- Create custom metadata for the VersionInfo table