Skip to content

Commit

Permalink
https://github.com/valdisiljuconoks/LocalizationProvider/issues/292
Browse files Browse the repository at this point in the history
  • Loading branch information
Valdis Iljuconoks committed Aug 15, 2024
1 parent 1fa30c7 commit cf39731
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/DbLocalizationProvider.Storage.SqlServer/SchemaUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ private void SyncSchema(SqlCommand cmd)
cmd.ExecuteNonQuery();
}

// *** #8 change - decrease length of ResourceKey column
cmd.CommandText = "ALTER TABLE [dbo].[LocalizationResources] ALTER COLUMN ResourceKey NVARCHAR(800) NOT NULL";
cmd.ExecuteScalar();

// *** #9 change - before creating new index for ResourceKey = UNIQUE there might be leftovers from previous versions
// *** #8 change - before creating new index for ResourceKey = UNIQUE there might be leftovers from previous versions
cmd.CommandText = "SELECT index_id FROM sys.indexes WHERE name='IX_ResourceKey' AND object_id = OBJECT_ID('dbo.LocalizationResources')";
result = cmd.ExecuteScalar();

Expand All @@ -136,7 +132,11 @@ private void SyncSchema(SqlCommand cmd)
cmd.CommandText = "DROP INDEX [dbo].[LocalizationResources].[IX_ResourceKey]";
cmd.ExecuteNonQuery();
}


// *** #9 change - decrease length of ResourceKey column
cmd.CommandText = "ALTER TABLE [dbo].[LocalizationResources] ALTER COLUMN ResourceKey NVARCHAR(800) NOT NULL";
cmd.ExecuteScalar();

// *** #10 change - index LocalizationResources.ResourceKey = UNIQUE
cmd.CommandText = "SELECT index_id FROM sys.indexes WHERE name='ix_UniqueResourceKey' AND object_id = OBJECT_ID('dbo.LocalizationResources')";
result = cmd.ExecuteScalar();
Expand Down

0 comments on commit cf39731

Please sign in to comment.