{"id":78760,"date":"2018-05-14T09:21:32","date_gmt":"2018-05-14T09:21:32","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=78760"},"modified":"2018-05-21T13:02:12","modified_gmt":"2018-05-21T13:02:12","slug":"good-enough-good-enough","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/good-enough-good-enough\/","title":{"rendered":"When is good enough, good enough?"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Currently the project I\u2019m working on is using Azure\u2019s Infrastructure as a Service (IaaS) and we want to move to using Azure SQL Database on Platform as a Service (PaaS). \u00a0The one thing stopping us doing that was cross database scripting, known in Azure terms as an Elastic Query. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Before we agreed the move to PaaS I wrote a prototype elastic query which worked, if we need it, the capability is there.<\/span><\/p>\n<p><span style=\"font-weight: 400\">I then started thinking about development. \u00a0My preferred method of development is using SQL Server on my laptop as a sandbox, then when I\u2019ve finished developing and written all my unit tests I promote it to a test box using SQL Source Control. \u00a0My problem, how do you develop locally when using functionality that is only available on an Azure SQL Database? I spent an hour or two investigating how this could be possible and came up with a couple of potential solutions:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Using a version of Azure to develop, not ideal because of potential costs and because I work from home sometimes I didn\u2019t want to be wholly reliant on an Azure connection. \u00a0We live in the middle of nowhere and get about 600KB on our broadband, and that\u2019s on a good day!!<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">I create the tables locally so that I can test the stored procedures etc and then write a migration script that deletes these tables and re-creates them as external data sources. \u00a0I ruled this one out because it would mean that I wouldn\u2019t be testing what I was deploying which was something I didn\u2019t like.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">So, I went back to the drawing board. \u00a0Generally cross database or elastic queries, whilst possible is not recommended so I decided I had to rule them out. \u00a0I then spent an hour working out how to change my schema and stored procedures and have come up with a viable solution to my problem. \u00a0I haven\u2019t written the code to change it but I\u2019m pretty happy with my solution and next week when I\u2019m back at work, currently I\u2019m enjoying a week at home with my husband doing gardening type things, I\u2019m looking forward to putting my solution in place.<\/span><\/p>\n<p><span style=\"font-weight: 400\">I suppose the reason I wanted to post this as to say that sometimes you have to stop and think about things and not be blinkered, just because something works doesn\u2019t mean to say it\u2019s the best solution. \u00a0My new solution I think will work far better and doesn\u2019t have the issues that cross-database scripting would give us.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Currently the project I\u2019m working on is using Azure\u2019s Infrastructure as a Service (IaaS) and we want to move to using Azure SQL Database on Platform as a Service (PaaS). \u00a0The one thing stopping us doing that was cross database scripting, known in Azure terms as an Elastic Query. Before we agreed the move to&#8230;&hellip;<\/p>\n","protected":false},"author":10747,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[57570],"class_list":["post-78760","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/78760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/10747"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=78760"}],"version-history":[{"count":1,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/78760\/revisions"}],"predecessor-version":[{"id":78761,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/78760\/revisions\/78761"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=78760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=78760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=78760"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=78760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}