Skip to content

Commit

Permalink
Add Update for existing records
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovan Crone authored and Aida committed Apr 11, 2019
1 parent 054e619 commit 2409796
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ protected override void Up(MigrationBuilder migrationBuilder)

if (migrationBuilder.ActiveProvider == SqlServer)
{
migrationBuilder.Sql(@"UPDATE [dbo].[Machines] SET [NaturalStateName] = CAST(LEFT(JSON_VALUE([StateJson],'$.AssemblyQualifiedName'), CHARINDEX(',', JSON_VALUE([StateJson],'$.AssemblyQualifiedName')) - 1) AS VARCHAR(450))");

migrationBuilder.Sql(@"CREATE NONCLUSTERED INDEX IX_Machines_SchematicName_NaturalStateName_UpdatedTime
ON [dbo].[Machines] ([SchematicName], [UpdatedTime], [NaturalStateName])
INCLUDE ([MachineId], [CommitNumber], [StateJson], [SchematicBytes])");
Expand Down

0 comments on commit 2409796

Please sign in to comment.