Easy to Use
Write database migrations in C# using a fluent API that's easy to learn and understand.
A migration framework for .NET much like Ruby on Rails Migrations
Write database migrations in C# using a fluent API that's easy to learn and understand.
Supports SQL Server, PostgreSQL, MySQL, SQLite, Oracle, Firebird, and more database providers.
Migrations are code that can be checked into version control and shared across teams.
Define both Up and Down methods to enable rolling back migrations when needed.
Use conditional logic to create database-specific migrations for different providers.
Extensible architecture with support for custom extensions and database-specific features.
FluentMigrator is a migration framework for .NET that allows you to manage database schema changes in a structured, version-controlled way. Instead of manually running SQL scripts, you write migrations as C# classes that can be executed automatically.
Traditional database development often involves:
FluentMigrator solves these problems by:
[Migration(20240101000000)]
public class CreateUsersTable : Migration
{
public override void Up()
{
Create.Table("Users")
.WithColumn("Id").AsInt32().NotNullable().PrimaryKey().Identity()
.WithColumn("Username").AsString(50).NotNullable().Unique()
.WithColumn("Email").AsString(255).NotNullable()
.WithColumn("CreatedAt").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentDateTime);
}
public override void Down()
{
Delete.Table("Users");
}
}Write your migrations once and run them on any supported database.
Ready to start using FluentMigrator? Check out our Quick Start Guide to create your first migration in just a few minutes.
fluent-migrator tag