Archive for March, 2008

26
Mar
08

Visual Studio 2005 and Monorail RC3 setup for local development on Vista/IIS 7

These are the steps I had to follow to get my Monorail RC3 project up and running in Visual Studio 2005 on Vista on my MacBook.

1. Install IIS6 compatibility, Metabase, and Application Development Features from Control Panel\Programs and Features\Turn Windows Features On and Off.

iis_setup

2. Follow the instructions here: How to map .rails to the asp.net runtime on IIS7.

3. If you are using <httpModules> in web.config, change the application pool to the Classic Application Pool (in IISManagementConsole, click the Advanced Settings… link on the right side). Alternatively, follow the instructions to migrate to the integrated pipeline mode (I couldn’t for this project).

Advertisements
25
Mar
08

SQL Server Change Management: The Low-Tech Approach

Dealing with database changes can really be a pain in the ass. Here’s one exceedingly low-tech solution that I am using.

On my current project (SQL Server, using SQLExpress for local development), we store a backup from the live database in a zip file in SVN. We store an actual live backup, but for another project I might scrub most of the data, depending on the size of the database and the nature of the personal info involved.

We name our SQL scripts for a particular release so that when sorted by file name, they execute in the correct order:

000_Create_New_Totally_Killer_Table.sql

001_Add_That_Column_We_Forgot_In_The_Last_Release.sql

Note that on SQL Server (and probably other RDBMSes as well), many scripts are order-independent (sprocs). Even so, many times it is easiest to deal with the migration as a series of deltas that execute in order.

We also store an SQL file that creates an empty database and user. I generated this by using SQL Management Studio to script my changes, and then deleting the cruft from the resultant script, so that it can run on SQL2005 and SQL2000.

We have a batch file like the following that any developer can run that will create a clean local copy of the database with all scripts applied.

This also is used to verify that script changes/additions are working before commiting to SVN.

It’s pretty low-tech but it works so far.

REM pass in the server name (for ex localhost\SQLEXPRESS)

REM unzip .bak backup from zip file

7za e Live_Database_Backup.zip -y

REM script that creates empty database, user, etc.

REM this SQL file can be created by hand or from Management Studio

type Create_Local_DB_And_Restore_From_live_Backup.sql >> tmp.sql

REM create monster script by concatenating in order of file name

REM we name them 000_foo.sql, 001_bar.sql etc

for /f %%G in (‘dir /b /o:n Path\To\Scripts\*.sql’) do type Path\To\Scripts\%%G >> tmp.sql

REM execute the monster script (uses windows auth)

osql -S %1 -d master -E -i tmp.sql

REM so we can examine tmp.sql if anything went wrong

pause

del Live_Database_Backup.bak

del tmp.sql

25
Mar
08

10 ? “HELLO WORLD” 20 GOTO 10