{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3124","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3124/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3124/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3124/events","html_url":"https://github.com/aspnet/EntityFramework/issues/3124","id":106367185,"number":3124,"title":"Migrations for multiple contexts can have the same name","user":{"login":"poke","id":132240,"avatar_url":"https://avatars.githubusercontent.com/u/132240?v=3","gravatar_id":"","url":"https://api.github.com/users/poke","html_url":"https://github.com/poke","followers_url":"https://api.github.com/users/poke/followers","following_url":"https://api.github.com/users/poke/following{/other_user}","gists_url":"https://api.github.com/users/poke/gists{/gist_id}","starred_url":"https://api.github.com/users/poke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poke/subscriptions","organizations_url":"https://api.github.com/users/poke/orgs","repos_url":"https://api.github.com/users/poke/repos","events_url":"https://api.github.com/users/poke/events{/privacy}","received_events_url":"https://api.github.com/users/poke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-14T15:29:44Z","updated_at":"2015-09-28T22:09:33Z","closed_at":null,"body":"If you have multiple contexts in your project, you can create multiple migrations with the same name. For example:\r\n\r\n    dnx ef migrations add Example -c ContextA\r\n    dnx ef migrations add Example -c ContextB\r\n\r\nThis will result in two `<timestamp>_Example.cs` files in the `Migrations` folder. Since the generated classes are partial, this only throws an error because the class then receives two `DbContextAttributes`.\r\n\r\nIn comparison, when trying to create two migrations with the same name for a single context, the command correctly fails with an error that the name is already used by an existing migration.\r\n\r\nBecause of how the migrations are created, adding a migration should always fail if one with the same name already exists, even if it is for another context.\r\n\r\nIn the long run, it might be more useful to either prefix the migrations by the context name automatically or even move them into a subfolder/subnamespace."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/143887957","html_url":"https://github.com/aspnet/EntityFramework/issues/3124#issuecomment-143887957","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3124","id":143887957,"user":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T22:09:33Z","updated_at":"2015-09-28T22:09:33Z","body":"Notes for triage:\r\n\r\n> Maybe we could infer a better namespace for the migration from the context’s namespace\r\n\r\nI like this, though perhaps just using the contexts name rather than namespace. I.e. `BlogContext` would give you `<root>.Migrations.Blog` and obviously use the same folder structure. I know we discussed this a while back and thought it wasn't optimal for the single context scenario... but I don't think it really makes that any worse (and of course you can always just move them back up if you don't want the additional nesting.\r\n"}}