anchor.diff:  // Count how many records have we inserted already...
   "SELECT Count(*) FROM [gb-road-traffic-counts-daily-measurement]" |> Database.executeScalarCommand
   "SELECT Count(*) FROM [gb-road-traffic-counts-location]" |> Database.executeScalarCommand
  -
  +"SELECT Count(*) FROM [gb-road-traffic-counts-road]" |> Database.executeScalarCommand
  +"SELECT Count(*) FROM [gb-road-traffic-counts-region]" |> Database.executeScalarCommand
   
   // Create some indices over the table to make filtering by time, station & pollutant faster
   "CREATE NONCLUSTERED INDEX IX_YearMonthDay ON [gb-road-traffic-counts-daily-measurement] (Year,Month,Day)" 
   |> Database.executeCommandWithTimeout (60 * 15)
  -"CREATE NONCLUSTERED INDEX IX_LocationIDYear ON [gb-road-traffic-counts-daily-measurement] (LocationID,Year)" 
  +"CREATE NONCLUSTERED INDEX IX_LocationID ON [gb-road-traffic-counts-daily-measurement] (LocationID)" 
   |> Database.executeCommandWithTimeout (60 * 15)
  -"CREATE NONCLUSTERED INDEX IX_Year ON [gb-road-traffic-counts-daily-measurement] (Year)" 
  +"CREATE NONCLUSTERED INDEX IX_RegionID ON [gb-road-traffic-counts-daily-measurement] (RegionID)" 
   |> Database.executeCommandWithTimeout (60 * 15)
  -"CREATE NONCLUSTERED INDEX IX_Month ON [gb-road-traffic-counts-daily-measurement] (Month)" 
  -|> Database.executeCommandWithTimeout (60 * 15)
  -"CREATE NONCLUSTERED INDEX IX_LocationID ON [gb-road-traffic-counts-daily-measurement] (LocationID)" 
  +"CREATE NONCLUSTERED INDEX IX_RoadID ON [gb-road-traffic-counts-daily-measurement] (RoadID)" 
   |> Database.executeCommandWithTimeout (60 * 15)
   
   // This is how to drop some index in case we do not actually want it!
   "DROP INDEX IX_YearMonthDay ON [gb-road-traffic-counts-daily-measurement]" 
  -|> Database.executeCommand
  +|> Database.executeCommand
positive.code:     |> Array.ofSeq
  
    do! Cloud.Logf "Calculating daily measurements"  
    let daily = measurements |> Array.mapi (fun idx (loc, date, group) ->
      { DailyMeasurement.ID = idx; Location = loc; Day = date.Day; Month = date.Month; Year = date.Year
        PedalCycles = group |> Seq.sumBy (fun r -> defaultArg r.PC 0)
        MotorVehicles = group |> Seq.sumBy (fun r -> defaultArg r.AMV 0) })
    
  
negative.code: // Domain model - also defines the structure of the database tables
  // ------------------------------------------------------------------------------------------------
  
  type Region = 
    { ID : int 
      Region : string }
  
  type Location = 
    { ID : int 
      Location : string }
  
  type Road =  
    { ID : int
      Latitude : float // NS
      Longitude : float // WE
      Road : string }
  
  type DailyMeasurement =
    { ID : int
      Location : Location
      Region : Region
      Road : Road
      Day : int
      Month : int
      Year : int
  