{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1427","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1427/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1427/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1427/events","html_url":"https://github.com/aspnet/EntityFramework/issues/1427","id":54793156,"number":1427,"title":"RelationalDataStoreCreator.EnsureCreated returns false if DB already exists and has schema","user":{"login":"egorpavlikhin","id":1160707,"avatar_url":"https://avatars.githubusercontent.com/u/1160707?v=3","gravatar_id":"","url":"https://api.github.com/users/egorpavlikhin","html_url":"https://github.com/egorpavlikhin","followers_url":"https://api.github.com/users/egorpavlikhin/followers","following_url":"https://api.github.com/users/egorpavlikhin/following{/other_user}","gists_url":"https://api.github.com/users/egorpavlikhin/gists{/gist_id}","starred_url":"https://api.github.com/users/egorpavlikhin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egorpavlikhin/subscriptions","organizations_url":"https://api.github.com/users/egorpavlikhin/orgs","repos_url":"https://api.github.com/users/egorpavlikhin/repos","events_url":"https://api.github.com/users/egorpavlikhin/events{/privacy}","received_events_url":"https://api.github.com/users/egorpavlikhin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-19T17:48:15Z","updated_at":"2015-01-19T18:18:31Z","closed_at":null,"body":"https://github.com/aspnet/EntityFramework/blob/48b776f65d97c6589fae1842215ce86119ccdaf7/src/EntityFramework.Relational/RelationalDataStoreCreator.cs#L64\r\n\r\nOtherwise the sample MVC app in Identity repo won't work on a relational db.\r\n\r\nCurrently:\r\n\r\n    public override bool EnsureCreated(IModel model)\r\n        {\r\n            Check.NotNull(model, \"model\");\r\n\r\n            if (!Exists())\r\n            {\r\n                Create();\r\n                CreateTables(model);\r\n                return true;\r\n            }\r\n\r\n            if (!HasTables())\r\n            {\r\n                CreateTables(model);\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\nShould be:\r\n\r\n    public override bool EnsureCreated(IModel model)\r\n        {\r\n            Check.NotNull(model, \"model\");\r\n \r\n            if (Exists() && HasTables())\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if (!Exists())\r\n            {\r\n                Create();\r\n            }\r\n\r\n            if (!HasTables())\r\n            {\r\n                CreateTables(model);\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/70537727","html_url":"https://github.com/aspnet/EntityFramework/issues/1427#issuecomment-70537727","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1427","id":70537727,"user":{"login":"egorpavlikhin","id":1160707,"avatar_url":"https://avatars.githubusercontent.com/u/1160707?v=3","gravatar_id":"","url":"https://api.github.com/users/egorpavlikhin","html_url":"https://github.com/egorpavlikhin","followers_url":"https://api.github.com/users/egorpavlikhin/followers","following_url":"https://api.github.com/users/egorpavlikhin/following{/other_user}","gists_url":"https://api.github.com/users/egorpavlikhin/gists{/gist_id}","starred_url":"https://api.github.com/users/egorpavlikhin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egorpavlikhin/subscriptions","organizations_url":"https://api.github.com/users/egorpavlikhin/orgs","repos_url":"https://api.github.com/users/egorpavlikhin/repos","events_url":"https://api.github.com/users/egorpavlikhin/events{/privacy}","received_events_url":"https://api.github.com/users/egorpavlikhin/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T18:18:31Z","updated_at":"2015-01-19T18:18:31Z","body":"So then it's rather a bug in Identity sample project, which should be calling Exists instead of EnsureCreated.\r\n\r\nhttps://github.com/aspnet/Identity/blob/dev/samples/IdentitySample.Mvc/Models/SampleData.cs#L20"}}