Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF add-migration generates empty migration

I added into my model a new table:

public DbSet<ReturnedTransactions> ReturnedTransactions { get; set; }

And i want my migrations to generate that table for me, so i did:

PM> Add-migration returnedTransactions

And it generated

public partial class returnedTransactions : DbMigration
{
    public override void Up()
    {
    }

    public override void Down()
    {
    }
}

How do i force this thing to generate proper code for me?

like image 966
ojek Avatar asked Feb 24 '13 02:02

ojek


Video Answer


2 Answers

I see this happen when I do not add my DBSet Entity to my DbContext class that is associated with the Migration Configuration file.

Although, it may not be the case here as we can see that the Asker included the line:

public DbSet<ReturnedTransactions> ReturnedTransactions { get; set; }

Still, this is something one should check when they are returned an empty migration class.

like image 133
Brian Merrell Avatar answered Oct 17 '22 00:10

Brian Merrell


Clear out the _MigrationHistory table.

like image 1
DickP Avatar answered Oct 16 '22 23:10

DickP