{"action":"created","comment":{"url":"https://api.github.com/repos/DbUp/DbUp/pulls/comments/39153674","id":39153674,"diff_hunk":"@@ -97,4 +101,77 @@ public static UpgradeEngineBuilder JournalToSqlTable(this UpgradeEngineBuilder b\n         builder.Configure(c => c.Journal = new SqlTableJournal(()=>c.ConnectionManager, ()=>c.Log, schema, table));\n         return builder;\n     }\n+\n+    /// <summary>\n+    /// Ensures that the database specified in the connection string exists.\n+    /// </summary>\n+    /// <param name=\"supported\">Fluent helper type.</param>\n+    /// <param name=\"connectionString\">The connection string.</param>\n+    /// <returns></returns>\n+    public static void SqlDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString)","path":"src/DbUp/Support/SqlServer/SqlServerExtensions.cs","position":21,"original_position":21,"commit_id":"d963f12fc509b9ba4c9bbedf1475b726b2328a2d","original_commit_id":"d963f12fc509b9ba4c9bbedf1475b726b2328a2d","user":{"login":"rickculpepper","id":4801808,"avatar_url":"https://avatars.githubusercontent.com/u/4801808?v=3","gravatar_id":"","url":"https://api.github.com/users/rickculpepper","html_url":"https://github.com/rickculpepper","followers_url":"https://api.github.com/users/rickculpepper/followers","following_url":"https://api.github.com/users/rickculpepper/following{/other_user}","gists_url":"https://api.github.com/users/rickculpepper/gists{/gist_id}","starred_url":"https://api.github.com/users/rickculpepper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickculpepper/subscriptions","organizations_url":"https://api.github.com/users/rickculpepper/orgs","repos_url":"https://api.github.com/users/rickculpepper/repos","events_url":"https://api.github.com/users/rickculpepper/events{/privacy}","received_events_url":"https://api.github.com/users/rickculpepper/received_events","type":"User","site_admin":false},"body":"Glad you changed your mind on replacing `connectionString`. That seemed to me that it fits the DbUp use cases... much better than `server` and `database`.\r\n\r\nThanks for the tip on `IUpgradeLog logger`. Will do...","created_at":"2015-09-10T12:29:41Z","updated_at":"2015-09-10T12:29:41Z","html_url":"https://github.com/DbUp/DbUp/pull/114#discussion_r39153674","pull_request_url":"https://api.github.com/repos/DbUp/DbUp/pulls/114","_links":{"self":{"href":"https://api.github.com/repos/DbUp/DbUp/pulls/comments/39153674"},"html":{"href":"https://github.com/DbUp/DbUp/pull/114#discussion_r39153674"},"pull_request":{"href":"https://api.github.com/repos/DbUp/DbUp/pulls/114"}}},"pull_request":{"url":"https://api.github.com/repos/DbUp/DbUp/pulls/114","id":44367291,"html_url":"https://github.com/DbUp/DbUp/pull/114","diff_url":"https://github.com/DbUp/DbUp/pull/114.diff","patch_url":"https://github.com/DbUp/DbUp/pull/114.patch","issue_url":"https://api.github.com/repos/DbUp/DbUp/issues/114","number":114,"state":"open","locked":false,"title":"Added EnsureDatabase.For","user":{"login":"rickculpepper","id":4801808,"avatar_url":"https://avatars.githubusercontent.com/u/4801808?v=3","gravatar_id":"","url":"https://api.github.com/users/rickculpepper","html_url":"https://github.com/rickculpepper","followers_url":"https://api.github.com/users/rickculpepper/followers","following_url":"https://api.github.com/users/rickculpepper/following{/other_user}","gists_url":"https://api.github.com/users/rickculpepper/gists{/gist_id}","starred_url":"https://api.github.com/users/rickculpepper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickculpepper/subscriptions","organizations_url":"https://api.github.com/users/rickculpepper/orgs","repos_url":"https://api.github.com/users/rickculpepper/repos","events_url":"https://api.github.com/users/rickculpepper/events{/privacy}","received_events_url":"https://api.github.com/users/rickculpepper/received_events","type":"User","site_admin":false},"body":"# EnsureDatabase.For #\r\n\r\nIssue **#74 Create Db if it doesn't exist**\r\n\r\nThis new DbUp method ensures the existence of the database that is going to be upgraded. If the database does not exist, it is created. The `CREATE DATABASE` command is executed with default values for all options.\r\n\r\n## Changes ##\r\n\r\n1. Added a new static class `EnsureDatabase` with a property, `EnsureDatabase.For`, for use semantics similar to `DeployChanges.To`. However, the type of `EnsureDatabase.For` is a new class, `SupportedDatabasesForEnsureDatabase` to disambiguate the extension classes. \r\n2. Added extension methods for all supported databases, but only implemented the SQL Server extension method. All other extensions methods throw `System.NotImplementedException`.\r\n\r\n## Notes ##\r\n1. The argument connectionString is the same connection string used with the Builder for the target database. The extension method works out the connection string for `master`.\r\n2. The return type of the extension method is void. If the database engine throws an exception when creating the database, that exception is _**not**_ caught.\r\n\r\n## Example ##\r\n```\r\nEnsureDatabase.For.SqlDatabase(connectionString);\r\n```\r\n## Open Issues ##\r\nIt seems like `EnsureDatabase.For` should let the world know what it is doing. For this reason, there are two TODO: items in the SQL Server extension method that highlight code that may need to be changed. The challenge is that we are not in the Builder, so we have no logging context.\r\n\r\n* `SqlServerExtensions.cs`, line 129-130. There is a TODO and a `Debug.WriteLine` that displays the master database connection string. This could probably be removed, but seemed like a good idea during debugging.\r\n* `SqlServerExtensions.cs`, line 171-172. There is a TODO and a `ConsoleWriteLine` where the extension method announces that it created the database. This seems like a good idea. However,  `Console.Writeline()` seems too invariant, but the lack of a logging context doesn't leave to many (easy) options.\r\n","created_at":"2015-09-07T15:51:23Z","updated_at":"2015-09-10T12:29:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a79705c625a0298689e2bd64818a1053925dd23","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DbUp/DbUp/pulls/114/commits","review_comments_url":"https://api.github.com/repos/DbUp/DbUp/pulls/114/comments","review_comment_url":"https://api.github.com/repos/DbUp/DbUp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DbUp/DbUp/issues/114/comments","statuses_url":"https://api.github.com/repos/DbUp/DbUp/statuses/d963f12fc509b9ba4c9bbedf1475b726b2328a2d","head":{"label":"rickculpepper:CreateDatabase","ref":"CreateDatabase","sha":"d963f12fc509b9ba4c9bbedf1475b726b2328a2d","user":{"login":"rickculpepper","id":4801808,"avatar_url":"https://avatars.githubusercontent.com/u/4801808?v=3","gravatar_id":"","url":"https://api.github.com/users/rickculpepper","html_url":"https://github.com/rickculpepper","followers_url":"https://api.github.com/users/rickculpepper/followers","following_url":"https://api.github.com/users/rickculpepper/following{/other_user}","gists_url":"https://api.github.com/users/rickculpepper/gists{/gist_id}","starred_url":"https://api.github.com/users/rickculpepper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickculpepper/subscriptions","organizations_url":"https://api.github.com/users/rickculpepper/orgs","repos_url":"https://api.github.com/users/rickculpepper/repos","events_url":"https://api.github.com/users/rickculpepper/events{/privacy}","received_events_url":"https://api.github.com/users/rickculpepper/received_events","type":"User","site_admin":false},"repo":{"id":41122122,"name":"DbUp","full_name":"rickculpepper/DbUp","owner":{"login":"rickculpepper","id":4801808,"avatar_url":"https://avatars.githubusercontent.com/u/4801808?v=3","gravatar_id":"","url":"https://api.github.com/users/rickculpepper","html_url":"https://github.com/rickculpepper","followers_url":"https://api.github.com/users/rickculpepper/followers","following_url":"https://api.github.com/users/rickculpepper/following{/other_user}","gists_url":"https://api.github.com/users/rickculpepper/gists{/gist_id}","starred_url":"https://api.github.com/users/rickculpepper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickculpepper/subscriptions","organizations_url":"https://api.github.com/users/rickculpepper/orgs","repos_url":"https://api.github.com/users/rickculpepper/repos","events_url":"https://api.github.com/users/rickculpepper/events{/privacy}","received_events_url":"https://api.github.com/users/rickculpepper/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rickculpepper/DbUp","description":"DbUp is a .NET library that helps you to deploy changes to SQL Server databases. It tracks which SQL scripts have been run already, and runs the change scripts that are needed to get your database up to date.  ","fork":true,"url":"https://api.github.com/repos/rickculpepper/DbUp","forks_url":"https://api.github.com/repos/rickculpepper/DbUp/forks","keys_url":"https://api.github.com/repos/rickculpepper/DbUp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rickculpepper/DbUp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rickculpepper/DbUp/teams","hooks_url":"https://api.github.com/repos/rickculpepper/DbUp/hooks","issue_events_url":"https://api.github.com/repos/rickculpepper/DbUp/issues/events{/number}","events_url":"https://api.github.com/repos/rickculpepper/DbUp/events","assignees_url":"https://api.github.com/repos/rickculpepper/DbUp/assignees{/user}","branches_url":"https://api.github.com/repos/rickculpepper/DbUp/branches{/branch}","tags_url":"https://api.github.com/repos/rickculpepper/DbUp/tags","blobs_url":"https://api.github.com/repos/rickculpepper/DbUp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rickculpepper/DbUp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rickculpepper/DbUp/git/refs{/sha}","trees_url":"https://api.github.com/repos/rickculpepper/DbUp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rickculpepper/DbUp/statuses/{sha}","languages_url":"https://api.github.com/repos/rickculpepper/DbUp/languages","stargazers_url":"https://api.github.com/repos/rickculpepper/DbUp/stargazers","contributors_url":"https://api.github.com/repos/rickculpepper/DbUp/contributors","subscribers_url":"https://api.github.com/repos/rickculpepper/DbUp/subscribers","subscription_url":"https://api.github.com/repos/rickculpepper/DbUp/subscription","commits_url":"https://api.github.com/repos/rickculpepper/DbUp/commits{/sha}","git_commits_url":"https://api.github.com/repos/rickculpepper/DbUp/git/commits{/sha}","comments_url":"https://api.github.com/repos/rickculpepper/DbUp/comments{/number}","issue_comment_url":"https://api.github.com/repos/rickculpepper/DbUp/issues/comments{/number}","contents_url":"https://api.github.com/repos/rickculpepper/DbUp/contents/{+path}","compare_url":"https://api.github.com/repos/rickculpepper/DbUp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rickculpepper/DbUp/merges","archive_url":"https://api.github.com/repos/rickculpepper/DbUp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rickculpepper/DbUp/downloads","issues_url":"https://api.github.com/repos/rickculpepper/DbUp/issues{/number}","pulls_url":"https://api.github.com/repos/rickculpepper/DbUp/pulls{/number}","milestones_url":"https://api.github.com/repos/rickculpepper/DbUp/milestones{/number}","notifications_url":"https://api.github.com/repos/rickculpepper/DbUp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rickculpepper/DbUp/labels{/name}","releases_url":"https://api.github.com/repos/rickculpepper/DbUp/releases{/id}","created_at":"2015-08-20T22:41:25Z","updated_at":"2015-08-22T15:40:15Z","pushed_at":"2015-09-08T11:44:15Z","git_url":"git://github.com/rickculpepper/DbUp.git","ssh_url":"git@github.com:rickculpepper/DbUp.git","clone_url":"https://github.com/rickculpepper/DbUp.git","svn_url":"https://github.com/rickculpepper/DbUp","homepage":"http://dbup.github.io","size":29747,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"DbUp:master","ref":"master","sha":"b5c70e292ca1e97d15fbc8e8c869364ae476d12e","user":{"login":"DbUp","id":1959007,"avatar_url":"https://avatars.githubusercontent.com/u/1959007?v=3","gravatar_id":"","url":"https://api.github.com/users/DbUp","html_url":"https://github.com/DbUp","followers_url":"https://api.github.com/users/DbUp/followers","following_url":"https://api.github.com/users/DbUp/following{/other_user}","gists_url":"https://api.github.com/users/DbUp/gists{/gist_id}","starred_url":"https://api.github.com/users/DbUp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DbUp/subscriptions","organizations_url":"https://api.github.com/users/DbUp/orgs","repos_url":"https://api.github.com/users/DbUp/repos","events_url":"https://api.github.com/users/DbUp/events{/privacy}","received_events_url":"https://api.github.com/users/DbUp/received_events","type":"Organization","site_admin":false},"repo":{"id":4995017,"name":"DbUp","full_name":"DbUp/DbUp","owner":{"login":"DbUp","id":1959007,"avatar_url":"https://avatars.githubusercontent.com/u/1959007?v=3","gravatar_id":"","url":"https://api.github.com/users/DbUp","html_url":"https://github.com/DbUp","followers_url":"https://api.github.com/users/DbUp/followers","following_url":"https://api.github.com/users/DbUp/following{/other_user}","gists_url":"https://api.github.com/users/DbUp/gists{/gist_id}","starred_url":"https://api.github.com/users/DbUp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DbUp/subscriptions","organizations_url":"https://api.github.com/users/DbUp/orgs","repos_url":"https://api.github.com/users/DbUp/repos","events_url":"https://api.github.com/users/DbUp/events{/privacy}","received_events_url":"https://api.github.com/users/DbUp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DbUp/DbUp","description":"DbUp is a .NET library that helps you to deploy changes to SQL Server databases. It tracks which SQL scripts have been run already, and runs the change scripts that are needed to get your database up to date.  ","fork":false,"url":"https://api.github.com/repos/DbUp/DbUp","forks_url":"https://api.github.com/repos/DbUp/DbUp/forks","keys_url":"https://api.github.com/repos/DbUp/DbUp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DbUp/DbUp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DbUp/DbUp/teams","hooks_url":"https://api.github.com/repos/DbUp/DbUp/hooks","issue_events_url":"https://api.github.com/repos/DbUp/DbUp/issues/events{/number}","events_url":"https://api.github.com/repos/DbUp/DbUp/events","assignees_url":"https://api.github.com/repos/DbUp/DbUp/assignees{/user}","branches_url":"https://api.github.com/repos/DbUp/DbUp/branches{/branch}","tags_url":"https://api.github.com/repos/DbUp/DbUp/tags","blobs_url":"https://api.github.com/repos/DbUp/DbUp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DbUp/DbUp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DbUp/DbUp/git/refs{/sha}","trees_url":"https://api.github.com/repos/DbUp/DbUp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DbUp/DbUp/statuses/{sha}","languages_url":"https://api.github.com/repos/DbUp/DbUp/languages","stargazers_url":"https://api.github.com/repos/DbUp/DbUp/stargazers","contributors_url":"https://api.github.com/repos/DbUp/DbUp/contributors","subscribers_url":"https://api.github.com/repos/DbUp/DbUp/subscribers","subscription_url":"https://api.github.com/repos/DbUp/DbUp/subscription","commits_url":"https://api.github.com/repos/DbUp/DbUp/commits{/sha}","git_commits_url":"https://api.github.com/repos/DbUp/DbUp/git/commits{/sha}","comments_url":"https://api.github.com/repos/DbUp/DbUp/comments{/number}","issue_comment_url":"https://api.github.com/repos/DbUp/DbUp/issues/comments{/number}","contents_url":"https://api.github.com/repos/DbUp/DbUp/contents/{+path}","compare_url":"https://api.github.com/repos/DbUp/DbUp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DbUp/DbUp/merges","archive_url":"https://api.github.com/repos/DbUp/DbUp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DbUp/DbUp/downloads","issues_url":"https://api.github.com/repos/DbUp/DbUp/issues{/number}","pulls_url":"https://api.github.com/repos/DbUp/DbUp/pulls{/number}","milestones_url":"https://api.github.com/repos/DbUp/DbUp/milestones{/number}","notifications_url":"https://api.github.com/repos/DbUp/DbUp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DbUp/DbUp/labels{/name}","releases_url":"https://api.github.com/repos/DbUp/DbUp/releases{/id}","created_at":"2012-07-11T20:59:02Z","updated_at":"2015-09-08T03:51:06Z","pushed_at":"2015-09-10T10:24:14Z","git_url":"git://github.com/DbUp/DbUp.git","ssh_url":"git@github.com:DbUp/DbUp.git","clone_url":"https://github.com/DbUp/DbUp.git","svn_url":"https://github.com/DbUp/DbUp","homepage":"http://dbup.github.io","size":35836,"stargazers_count":208,"watchers_count":208,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":108,"mirror_url":null,"open_issues_count":19,"forks":108,"open_issues":19,"watchers":208,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DbUp/DbUp/pulls/114"},"html":{"href":"https://github.com/DbUp/DbUp/pull/114"},"issue":{"href":"https://api.github.com/repos/DbUp/DbUp/issues/114"},"comments":{"href":"https://api.github.com/repos/DbUp/DbUp/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/DbUp/DbUp/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/DbUp/DbUp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DbUp/DbUp/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/DbUp/DbUp/statuses/d963f12fc509b9ba4c9bbedf1475b726b2328a2d"}}}}