{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/Identity/issues/551","labels_url":"https://api.github.com/repos/aspnet/Identity/issues/551/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Identity/issues/551/comments","events_url":"https://api.github.com/repos/aspnet/Identity/issues/551/events","html_url":"https://github.com/aspnet/Identity/issues/551","id":102951258,"number":551,"title":"ToTable Rename of Identity Models causes migration error","user":{"login":"dansiegel","id":3860573,"avatar_url":"https://avatars.githubusercontent.com/u/3860573?v=3","gravatar_id":"","url":"https://api.github.com/users/dansiegel","html_url":"https://github.com/dansiegel","followers_url":"https://api.github.com/users/dansiegel/followers","following_url":"https://api.github.com/users/dansiegel/following{/other_user}","gists_url":"https://api.github.com/users/dansiegel/gists{/gist_id}","starred_url":"https://api.github.com/users/dansiegel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dansiegel/subscriptions","organizations_url":"https://api.github.com/users/dansiegel/orgs","repos_url":"https://api.github.com/users/dansiegel/repos","events_url":"https://api.github.com/users/dansiegel/events{/privacy}","received_events_url":"https://api.github.com/users/dansiegel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-25T05:22:28Z","updated_at":"2015-08-25T05:22:28Z","closed_at":null,"body":"When trying to rename the Entity tables a ModelItemNotFoundException is thrown when a new migration is attempted. This occurs whether the base migration is left in place or not. The project is 100% the boiler plate project created when you start a new project with Individual Accounts. The only change is shown below.\r\n```csharp\r\n    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>\r\n    {\r\n        protected override void OnModelCreating(ModelBuilder builder)\r\n        {\r\n            base.OnModelCreating(builder);\r\n            builder.Entity<ApplicationUser>().ToTable( \"Users\" );\r\n            builder.Entity<IdentityRole>().ToTable( \"Roles\" );\r\n            builder.Entity<IdentityRoleClaim>().ToTable( \"RoleClaims\" );\r\n            builder.Entity<IdentityUserRole>().ToTable( \"UserRoles\" );\r\n        }\r\n    }\r\n```\r\n\r\nPS C:\\Repos\\Test & Demo\\WebApplication2\\src\\WebApplication2> dnx . ef migration add Test\r\nUsing context 'ApplicationDbContext'.\r\nMicrosoft.Data.Entity.Metadata.ModelItemNotFoundException: The entity type 'Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole' requires a key to be defined.\r\n   at Microsoft.Data.Entity.Metadata.EntityTypeExtensions.GetPrimaryKey(IEntityType entityType)\r\n   at Microsoft.Data.Entity.Migrations.Infrastructure.ModelDiffer.<Add>d__25.MoveNext()\r\n   at Microsoft.Data.Entity.Migrations.Infrastructure.ModelDiffer.<DiffCollection>d__47\\`1.MoveNext()\r\n   at System.Linq.Enumerable.\\<ConcatIterator>d__1\\`1.MoveNext()\r\n   at System.Linq.Enumerable.\\<ConcatIterator>d__1\\`1.MoveNext()\r\n   at System.Linq.Enumerable.\\<ConcatIterator>d__1\\`1.MoveNext()\r\n   at Microsoft.Data.Entity.Migrations.Infrastructure.ModelDiffer.Sort(IEnumerable\\`1 operations, ModelDifferContext diffContext)\r\n   at Microsoft.Data.Entity.Migrations.Infrastructure.ModelDiffer.GetDifferences(IModel source, IModel target)\r\n   at Microsoft.Data.Entity.Commands.Migrations.MigrationScaffolder.ScaffoldMigration(String migrationName, String rootNamespace)\r\n   at Microsoft.Data.Entity.Commands.MigrationTool.AddMigration(String migrationName, String contextTypeName, String startupAssemblyName, String rootNamespace, String projectDir)\r\n   at Microsoft.Data.Entity.Commands.Program.<>c__DisplayClass12_0.<AddMigration>b__0()\r\n   at Microsoft.Data.Entity.Commands.Program.Execute(String startupProject, Func\\`1 invoke)\r\n   at Microsoft.Data.Entity.Commands.Program.AddMigration(String name, String context, String startupProject)\r\n   at Microsoft.Data.Entity.Commands.Program.<>c__DisplayClass10_1.\\<Main>b__7()\r\n   at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)\r\n   at Microsoft.Data.Entity.Commands.Program.Main(String[] args)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)\r\n   at Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)\r\n   at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)\r\n   at dnx.host.Bootstrapper.RunAsync(List\\`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)\r\n   at dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)\r\n   at dnx.host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)"}}