Reseed database not working Entity ASP.NEt
In my ASP.NET MVC project I enabled migrations, and filled in the Seed
method. So I did update-database -Verbose, and that worked fine. But I
added some extra things that should be Seeded aswell. But how to drop the
database and reSeed it all?
internal sealed class Configuration :
DbMigrationsConfiguration<Actual.Models.ActualContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(X.Models.MyContext context)
{
var footers = new List<Foobar>
{
The update-database -Verbose command in the Package Manager Controller
isn't doing something like re-seed.
> PM> update-database -Verbose -Force Using StartUp project 'XX'. Using
> NuGet project 'XX'. Specify the '-Verbose' flag to view the SQL
> statements being applied to the target database. Target database is:
> 'X.Models.MyContext' (DataSource: (localdb)\v11.0, Provider:
> System.Data.SqlClient, Origin: Convention). No pending code-based
> migrations. Applying automatic migration:
> 200308230838465_AutomaticMigration. ALTER TABLE [dbo].[Foobars] ALTER
> COLUMN [Name] [nvarchar](50) NOT NULL ALTER TABLE [dbo].[Foobars]
> ALTER COLUMN [Email] [nvarchar](max) NOT NULL [Inserting migration
> history record] Running Seed method.
No comments:
Post a Comment