Skip to content

Instantly share code, notes, and snippets.

@edrohler
Created July 31, 2015 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edrohler/7e119015e2bbb51f8398 to your computer and use it in GitHub Desktop.
Save edrohler/7e119015e2bbb51f8398 to your computer and use it in GitHub Desktop.
EF7 migration sql alter scripts
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) + '.'");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment