1

I'm currently using RoundhousE to manage my database migrations and this works really nicely.

I have been looking into various migration creation technologies like FluentMigrator and some others. The possibility for errors though seems really high because most of them aren't strongly typed. For instance this is a migration from FluentMigrator

public class CreateMemberTable : Migration
{
    public override void Up()
    {
        Create.Table("Members")
            .WithNamedIdColumn("MemberId")
            .WithColumn("Name").AsString().NotNullable();
    }

    public override void Down()
    {
        Delete.Table("Members");
    }
}

I've used Entity Framework code-first before and really liked the migration engine in that it generates code based migrations then you can make any changes that you require afterwards. However I don't really need the rest of the EF framework, it's a bit heavyweight for what i'm looking for.

Would it be acceptable to just use EF for migrations but not bother with any of the rest of it? There's also a nice roundhouse plugin

Most of the data i'm using is flat to something like PetaPoco or Dapper seems like a lighter solution from an ORM standpoint.

Neil
  • 5,179
  • 8
  • 48
  • 87
  • But what's the problem with the hard-coded literals? Each migration is tightly bound to the snapshot of code which was current when it was created. If you, say, rename the property "Name" to "FullName" in code, you create a new migration for that change rather than editing any existing one. Assuming the old migration has been delivered to clients and\or applied already. – Monsignor Apr 20 '18 at 17:02

1 Answers1

1

I believe you can, but to do so you have to bring about the mapping pieces of EF. Because of that I'm not sure how much you would gain over not using EF in your code. But it's definitely possible, it's just tied to the mapping constructs and context.

One can also use RH (RoundhousE) RefreshDatabase with just SQL files if you want to go that route.

ferventcoder
  • 11,952
  • 3
  • 57
  • 90
  • I've set something like this up but from the command line. I wrote my own console app to run the migrations to create a script and stick it in the up folder. I didn't like the idea of losing functionality from the EF migration engine like the resizing of columns. – Neil Apr 02 '13 at 13:13