 				multi.exec releaseLock
 
 class MigrationClient
-	constructor: (old_settings, new_settings) ->
-		@rclient_old = redis.createClient(old_settings)
-		@rclient_new = redis.createClient(new_settings)
+	constructor: (@old_settings, @new_settings) ->
+		@rclient_old = redis.createClient(@old_settings)
+		@rclient_new = redis.createClient(@new_settings)
 		@new_key_schema = new_settings.key_schema
-		@migration_phase = new_settings.migration_phase
+		# check that migration phase is valid on startup
+		@getMigrationPhase()
+
+	getMigrationPhase: () ->
+		@migration_phase = @new_settings.migration_phase  # FIXME: allow setting migration phase while running for testing
 		throw new Error("invalid migration phase") unless @migration_phase in ['prepare', 'switch', 'rollback']
+		return @migration_phase
 
 	getMigrationStatus: (key, migrationKey, callback) ->
 		async.series [

					logger.debug {project_id}, "using old client because migration key does not exist"
					return callback(null, @rclient_old)
			else
				logger.error {key: key, migration_phase: @migration_phase}, "unknown migration phase"
				callback(new Error('invalid migration phase'))
	multi: () ->
		new Multi(@)

				else
					logger.debug {project_id}, "using old client because migration key does not exist"
					return callback(null, @rclient_old)
			else if migration_phase is "switch"
				# As we deploy the "switch" phase new docupdaters will set the migration
				# flag for projects which have an empty queue in the old redis, and
				# write updates into the new redis.  Existing docupdaters still in the
