Skip to content

Instantly share code, notes, and snippets.

@edrohler
Created July 31, 2015 22:10
Show Gist options
  • Select an option

  • Save edrohler/7e119015e2bbb51f8398 to your computer and use it in GitHub Desktop.

Select an option

Save edrohler/7e119015e2bbb51f8398 to your computer and use it in GitHub Desktop.

Revisions

  1. edrohler created this gist Jul 31, 2015.
    8 changes: 8 additions & 0 deletions ef7sqlalterscripts.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    migration.Sql("ALTER TABLE dbo.Availability ADD TotalHours AS DATEDIFF(SECOND,BeginTimeUtc,EndtimeUtc)/3600");
    migration.Sql("ALTER TABLE dbo.PayRate ADD EstWeeklyRateLow AS HourlyRateLow*DesiredWeeklyHours");
    migration.Sql("ALTER TABLE dbo.PayRate ADD EstWeeklyRateHigh AS HourlyRateHigh*DesiredWeeklyHours");
    migration.Sql("ALTER TABLE dbo.Location ADD GeoPoint AS geography::Point(Latitude,Longitude, 4326)");
    migration.Sql("ALTER TABLE dbo.ZipCodeLookup ADD GeoPoint AS geography::Point(Latitude,Longitude, 4326)");
    migration.Sql("ALTER TABLE dbo.Contact ADD DisplayName AS FirstName + ' ' + LastName");
    migration.Sql("ALTER TABLE dbo.Contact ADD LastNameFirst AS LastName + ', ' + FirstName");
    migration.Sql("ALTER TABLE dbo.Contact ADD PublicName AS FirstName + ' ' + SUBSTRING(LastName, 1, 1) + '.'");