This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Create a table of pivoted data (the kind of thing you might expect to be imported from CSV) | |
/****** Object: Table [dbo].[FruitBaskets] Script Date: 3/10/2014 10:48:23 AM ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. create the table | |
/****** Object: Table [dbo].[Population] Script Date: 3/10/2014 7:47:16 PM ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scenario | |
We've got two Azure web sites (Staging and Production), each with their respective database and we want to deploy to both websites from the same Git repository using continuous deployment. We need to take advantage of config transforms to accommodate the differences between the two environments, such as connection strings, for example. | |
Continuous deployment is fairly straight-forward, as we can simply specify different branches for each enivronment. For example, using GitFlow, we can use the "develop" branch to deploy to our Acceptance or Staging environment and our "master" branch to deploy to our Production environment. This allows us to use Pull Requests as an approval workflow for automated contiuous deployment. | |
// Setup | |
1) To enable config transforms for a web application project, simply add a transform for each environment required, in this case "Staging": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: 2. DbUp Database Migrations | |
echo Handling Data Migrations. | |
%MSBUILD_PATH% HelloWorld.DbUp\HelloWorld.DbUp.csproj | |
IF !ERRORLEVEL! NEQ 0 goto error | |
echo Running DbUp. | |
:: call DbUp with the named connection string for the SQL Azure database i.e. "%SQLAZURECONNSTR_connection_string_name%" | |
call %DEPLOYMENT_SOURCE%\HelloWorld.DbUp\bin\debug\HelloWorld.DbUp.exe "%SQLAZURECONNSTR_HelloWorld_db%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rewriteMaps> | |
<rewriteMap name="MaintenanceIpAddressWhitelist" defaultValue=""> | |
<!-- add allowed IP addresses to grant access during maintenance period --> | |
<add key="192.168.0.1" value="1" /> | |
<add key="127.0.0.1" value="1" /> | |
</rewriteMap> |