<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>2017-11 on Funky Si's Blog (Dev)</title><link>https://blog-dev.funkysi1701.com/2017/11/</link><description>Recent content in 2017-11 on Funky Si's Blog (Dev)</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>funkysi1701@gmail.com (Simon Foster)</managingEditor><webMaster>funkysi1701@gmail.com (Simon Foster)</webMaster><lastBuildDate>Mon, 13 Nov 2017 20:00:45 +0000</lastBuildDate><atom:link href="https://blog-dev.funkysi1701.com/2017/11/index.xml" rel="self" type="application/rss+xml"/><item><title>Zero code changes outside of git</title><link>https://blog-dev.funkysi1701.com/posts/2017/get-zero-code-changes-outside-source-control/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Mon, 13 Nov 2017 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2017/get-zero-code-changes-outside-source-control/</guid><category term="Git">Git</category><category term="SQL">SQL</category><category term="VisualStudio">VisualStudio</category><category term="SourceCode">SourceCode</category><description>&lt;p&gt;Source control is bread and butter for web developers, however not so much for SQL developers and other business people. One of my goals for the coming year is to get the whole of my team using source control processes.&lt;/p&gt;
&lt;p&gt;One of the arguments against using source control is there will always be a few exceptions where it won’t be used. Lets look at a few scenarios to help make the case for source control.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Scenario One&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Web Dev 1 makes a change in production to fix an issue and doesn’t use source control. Web Dev 2 is working on a new feature and makes use of source control. He is given the sign-off to deploy his new feature and in the process undoes Web Dev 1’s fix.&lt;/p&gt;
&lt;p&gt;Management blames Web Dev 2 as they “broke” stuff during the deployment. Web Dev 2 doesn’t understand what happened and Web Dev 1 is oblivious to the entire scenario despite in reality being part of the problem.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Scenario Two&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A SQL Dev works all night to fix a problem. He deploy to production and doesn’t notice a missed where clause due to lack of sleep.&lt;/p&gt;
&lt;p&gt;—&lt;/p&gt;
&lt;p&gt;Let’s look at these two scenarios done with the whole team buying into source control.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Scenario One&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Web Dev 1 makes a change in production to fix an issue and also commits to source control. This takes him an extra 5 minutes (if that!) Web Dev 2 is working on a new feature and makes use of source control. He is given the sign-off to deploy his new feature and in the process merges Web Dev 1’s fix before he deploys to production.&lt;/p&gt;
&lt;p&gt;Management is happy with Web Dev 1, nothing is broken and new functionality has made the website better not worse.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Scenario Two&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A SQL Dev works all night to fix a problem. He deploy to production and doesn’t notice a missed where clause due to lack of sleep, he also commits to source control this takes him an extra 5 minutes (if that!).&lt;/p&gt;
&lt;p&gt;In the morning a colleague looks through the commits made during the night and queries the missing where clause. A fix is made in source control and deployed, management and the client are unaware that a problem was created and fixed.&lt;/p&gt;
&lt;p&gt;—&lt;/p&gt;
&lt;p&gt;These are simple scenarios but I cannot think of any situation where the outcome would be better to not use source control. These examples assume no continuous deployment, adding this to the system before every team has bought into source control would cause bugs and issues all over the place.&lt;/p&gt;
&lt;p&gt;However with a team that is 100% behind source control continuous deployment can achieve an amazing productivity boost. After every commit code could be automatically tested, reviewed by other members of the team and deployed to test environments for further analysis. Only tested code that has been reviewed can get anywhere near production environments.&lt;/p&gt;
&lt;p&gt;Having said all this there are ways especially on the SQL side to mitigate loosing changes while you work on training individuals and convincing management. Before any code is deployed to production do a schema compare. If you only see changes you have made you can proceed, if you don’t shout at your team.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Code Reviews&lt;br&gt;
Team awareness of what is being changed&lt;br&gt;
History of changes&lt;br&gt;
Smoother Deployments&lt;br&gt;
Automation&lt;br&gt;
Better Teamwork&lt;br&gt;
Diff changes between different versions&lt;br&gt;
Many more&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disadvantages&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Time to learn tools&lt;br&gt;
Remember to commit changes&lt;br&gt;
Technologies that use binary files harder to version control&lt;/p&gt;</description></item><item><title>SQL with Visual Studio Code</title><link>https://blog-dev.funkysi1701.com/posts/2017/sql-with-visual-studio-code/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Mon, 06 Nov 2017 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2017/sql-with-visual-studio-code/</guid><category term="Database">Database</category><category term="SQL">SQL</category><category term="VisualStudio">VisualStudio</category><description>&lt;p&gt;Writing SQL queries is typically done with SQL Management Studio (SSMS). However this tool is a bit of a beast so let’s look at how you could use Visual Studio Code instead.&lt;/p&gt;
&lt;p&gt;Visual Studio Code is a free text editor but it is so much more than just a text editor. VS Code can be downloaded from &lt;a href="https://code.visualstudio.com/Download" target="_blank" rel="noopener noreferrer"&gt;https://code.visualstudio.com/Download&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;To work with SQL Server download the mssql extension. Press &lt;strong&gt;CTRL+SHIFT+P&lt;/strong&gt; and then Select &lt;strong&gt;Install Extension&lt;/strong&gt; and type &lt;strong&gt;mssql&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Intellisense in Visual Studio Code is brilliant, better than SSMS. Lets look at how to get it all set up.&lt;/p&gt;
&lt;p&gt;Create a new file and set the language type to SQL (Press &lt;strong&gt;CTRL+K,M&lt;/strong&gt; )&lt;/p&gt;
&lt;p&gt;Open the command palette, &lt;strong&gt;CTRL+SHIFT+P&lt;/strong&gt; and type SQL to show the mssql commands. Select the Connect command.&lt;/p&gt;
&lt;p&gt;Then select &lt;strong&gt;Create Connection Profile&lt;/strong&gt; , this creates a profile to connect with your SQL Server. Follow the prompts to get it all setup.&lt;/p&gt;
&lt;p&gt;Look in the bottom right corner of the status bar and you should see you are connected.&lt;/p&gt;
&lt;p&gt;Now if you type sql you will see a long list of SQL code snippets that you could use.&lt;/p&gt;
&lt;p&gt;
&lt;img class="img-fluid" alt="SQL Code snippets" src="https://blog-dev.funkysi1701.com/images/2017/vscode-sql-snippets.png" loading="lazy"
width="1016" height="534"
/&gt;
&lt;/p&gt;
&lt;p&gt;Choose a snippet to create, and edit it as required. When you are happy press **CTRL+SHIFT+E ** to execute.&lt;/p&gt;
&lt;p&gt;This is basically all there is to it. However this is an incredibly powerful way of working, the intellisense instantly tells you what database objects you can use in your query and there is a wealth of different snippets you can use.&lt;/p&gt;
&lt;p&gt;When returning data you get a similar view to SSMS but you can save as Excel, CSV or JSON.&lt;/p&gt;
&lt;p&gt;SSMS is a very graphical way of doing things, you can double click a table and see its columns or indexes. VS Code relies on TSQL commands but you have access to exactly the same information.&lt;/p&gt;
&lt;p&gt;For more information about VS Code and the mssql extension check out &lt;a href="https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-develop-use-vscode" target="_blank" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-develop-use-vscode&lt;/a&gt;
&lt;/p&gt;</description></item></channel></rss>