Fluent migrations framework for .NET
Fluent Migrator is a migration framework for .NET much like Ruby on Rails Migrations. Migrations are a structured way to alter your database schema and are an alternative to creating lots of sql scripts that have to be run manually by every developer involved. Migrations solve the problem of evolving a database schema for multiple databases (for example, the developer's local database, the test database and the production database). Database schema changes are described in classes written in C# that can be checked into a version control system.
How to use it
- Database-agnostic migrations: Quickstart
- Database-specific migrations:
- Frequently Asked Questions
- FluentMigrator Comparison to Entity Framework Core Migrations
What does it look like?
This is an example of a database-agnostic migration:
using FluentMigrator;
namespace test
{
[Migration(20180430121800)]
public class AddLogTable : Migration
{
public override void Up()
{
Create.Table("Log")
.WithColumn("Id").AsInt64().PrimaryKey().Identity()
.WithColumn("Text").AsString();
}
public override void Down()
{
Delete.Table("Log");
}
}
}
Current Release
Upgrade guides
Supported databases
For the current release these are the supported databases:
Database | Identifier | Alternative identifier(s) |
---|---|---|
Microsoft SQL Server 2019 | SqlServer2016(1) | SqlServer |
Microsoft SQL Server 2017 | SqlServer2016(2) | SqlServer |
Microsoft SQL Server 2016 | SqlServer2016 | SqlServer |
Microsoft SQL Server 2014 | SqlServer2014 | SqlServer |
Microsoft SQL Server 2012 | SqlServer2012 | SqlServer |
Microsoft SQL Server 2008 | SqlServer2008 | SqlServer |
Microsoft SQL Server 2005 | SqlServer2005 | SqlServer |
Microsoft SQL Server 2000 | SqlServer2000 | SqlServer |
PostgreSQL | Postgres | PostgreSQL |
PostgreSQL 9.2 | Postgres92 | PostgreSQL92 |
PostgreSQL 10.0 | PostgreSQL10_0 | PostgreSQL |
PostgreSQL 11.0 | PostgreSQL11_0 | PostgreSQL |
MySQL 4 | MySql4 | MySql |
MySQL 5 | MySql5 | MySql, MariaDB |
Oracle | Oracle | |
Oracle (managed ADO.NET) | OracleManaged | Oracle |
Oracle (DotConnect ADO.NET) | OracleDotConnect | Oracle |
Microsoft JET Engine (Access) | Jet | |
SQLite | Sqlite | |
Firebird | Firebird | |
Amazon Redshift | Redshift | |
SAP Hana | Hana | |
DB2 | DB2 | |
DB2 iSeries | DB2 iSeries | DB2 |
- (1) All integration tests ran without error against an SQL Server 2019 using the SqlServer2016 dialect.
- (2) All integration tests ran without error against an SQL Server 2017 using the SqlServer2016 dialect.
- (3) Support for Microsoft SQL Server Compact Edition is being dropped due to Microsoft end-of-life support date passing.
- (4) Support for SAP SQL Anywhere is being dropped due to SAP not supporting a .NET Core / .NET 5 database driver.
More Information on FluentMigrator
- FAQ
- Sean Chambers on the Herding Code podcast