Questions tagged [fluent-migrator]

FluentMigrator is a migration framework for the .NET platform that lets you easily create migration-steps that fit very nicely into an automated deployment scenario.

FluentMigrator is a migration framework that let's you easily create migrations that fit very nicely into an automated deployment scenario.

The framework allows for forwards and backwards migration using a Fluent API that makes it easy to chain together updates for a database schema.

Additionally Fluent Migrator exposes several Runners to let you run the migrations, including nAnt, MSBuild or Rake (using the Albacore tasks which extends the built-in tasks for Rake)

Read more about FluentMigrator

230 questions
61
votes
5 answers

Can I create a column of nvarchar(MAX) using FluentMigrator?

Using FluentMigrator, the default creation of a Column using .AsString() results in an nvarchar(255). Is there a simple way (before I modify the FluentMigrator code) to create a column of type nvarchar(MAX)?
Darren Oster
  • 9,146
  • 10
  • 48
  • 66
47
votes
2 answers

Is it possible to use fluent migrator in application_start?

I'm using fluent migrator to manage my database migrations, but what I'd like to do is have the migrations run at app start. The closest I have managed is this: public static void MigrateToLatest(string connectionString) { using (var announcer =…
ilivewithian
  • 19,476
  • 19
  • 103
  • 165
38
votes
1 answer

How to drop column with FluentMigrator?

I am using .Net4.5 and C#, I am working on one of database migrations using FluentMigrator. I am able to alter tables and add columns by using Alter.Table("Items").InSchema("Pricing") …
Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265
26
votes
5 answers

Execute FluentMigrator migrations from code

Are there any tutorials or example code for executing FluentMigrator migrations from within code? Some "Getting Started..." tutorial would be just awesome. All I was able to find was FluentMigrator.Tests (unit tests), inside FluentMigrator source,…
Paya
  • 5,124
  • 4
  • 45
  • 71
23
votes
2 answers

Fluent migrator. How to add datetime column with default values as current date?

How can I alter column in fluent migration with default date time value that is current date time? So I need smth like this: ALTER TABLE database ADD column DATETIME DEFAULT GETDATE() NOT NULL; only for fluent migration. Thanks.
Seth
  • 233
  • 1
  • 2
  • 4
18
votes
2 answers

Add Constraint to Table column when using Create.Table, FluentMigrator

I am using FluentMigrator to create a new table in DB. After I created, i realized that I need to add a constraint like the following in T-Sql: Assume I already have a table tableA Alter Table tableA Add Constraint ConstraintA…
AlliceSmash
  • 687
  • 1
  • 11
  • 19
18
votes
2 answers

What can Entity Framework Migrations do that FluentMigrator cannot?

I have several databases currently using FluentMigrator and am curious to know how Entity Framework Migrations compare. Can EF Migrations seed data in migrations and selectively run migration scripts based on environments like FluentMigrator can…
16
votes
1 answer

EntityFramework code based migrations, how is order determined?

I'm using EF 5.0 and I would like to start using Code-based migrations I've used fluent migrator and there is a concept of migration order. Migrations can be migrated/rollback no matter the database's migration version. Does Entity Framework have…
14
votes
3 answers

FluentMigrator rolling back to a Not Nullable column?

Given the following Migration: [Migration(1)] public class Mig001 : Migration { public override void Up() { Alter.Table("foo").AlterColumn("bar").AsInt32().Nullable(); } public override void Down() { …
user1838662
  • 503
  • 7
  • 17
12
votes
2 answers

FluentMigrator - Check if Foreign Key exists before deleting it

I am using FluentMigrator to migrate one database schema to another. I have a case in which I want to check if a foreign key exists before deleting it. Previously, I just delete the foreign key by doing:…
noblerare
  • 10,277
  • 23
  • 78
  • 140
12
votes
2 answers

FluentMigrator not running migrations

I have inherited a project that uses FluentMigrator to manage migrations. Originally the project was executing the migrations in-process when the application started up but I.T. has cracked down on that and we now have to provide scripts to a DBA…
Jeff Hornby
  • 12,948
  • 4
  • 40
  • 61
12
votes
1 answer

Using FluentMigrator with an existing database

I'm looking for a migrations framework that will work with an existing project that uses .NetTiers, an older ORM that requires CodeSmith to generate the data access code. We have some experience of roundhouse, and we have had success in using it. We…
Rebecca
  • 13,914
  • 10
  • 95
  • 136
11
votes
1 answer

Rolling back to previous version in Fluent Migrator

I am attempting to get migrations working with my project using fluent migrator. But due to the lack of documentation I am struggling to figure out how to rollback and have the Down method called for my migration class. I set up the db with an…
jcvandan
  • 14,124
  • 18
  • 66
  • 103
11
votes
4 answers

FluentMigrator migration succeeds, but no changes to DB

I must be missing something pretty basic. I'm working on a legacy project, and I'm trying to bring FluentMigrator into the mix cause I've got some interesting database changes and data migrations coming up that I think will be made much easier by…
Remi Despres-Smyth
  • 4,173
  • 3
  • 36
  • 46
11
votes
1 answer

Explanation of Migrators (FluentMigrator)?

Could someone explain the concept of Migrators (specifically fluentmigrator)? Here are the (possibly confused) facts Ive gleaned on the subject: Is it a way to initially create then maintain updates for a database by way of versioning. The first…
user1838662
  • 503
  • 7
  • 17
1
2 3
15 16