feat(config-db): migration WidenSystemArtifactPerSiteStatus (DEP-3, WP2 task 2.9)
AlterColumn SystemArtifactDeploymentRecords.PerSiteStatus nvarchar(4000) -> nvarchar(max), plus docs/plans/sql/WidenSystemArtifactPerSiteStatus.sql for manual production application (not yet applied to QA/DEV). Kept in its own commit so the integrator can regenerate it on merge.
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
-- WidenSystemArtifactPerSiteStatus (2026-12-03, DEP-3 / code-review WP2 task 2.9). Widens
|
||||||
|
-- SystemArtifactDeploymentRecords.PerSiteStatus from nvarchar(4000) to nvarchar(max): one serialized
|
||||||
|
-- per-site result per site overflowed 4000 chars at ~25 sites, failing Deploy Artifacts after every
|
||||||
|
-- site had applied. The table holds one small row per Deploy Artifacts run. Not yet applied to QA/DEV.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
DECLARE @var nvarchar(max);
|
||||||
|
SELECT @var = QUOTENAME([d].[name])
|
||||||
|
FROM [sys].[default_constraints] [d]
|
||||||
|
INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
|
||||||
|
WHERE ([d].[parent_object_id] = OBJECT_ID(N'[SystemArtifactDeploymentRecords]') AND [c].[name] = N'PerSiteStatus');
|
||||||
|
IF @var IS NOT NULL EXEC(N'ALTER TABLE [SystemArtifactDeploymentRecords] DROP CONSTRAINT ' + @var + ';');
|
||||||
|
ALTER TABLE [SystemArtifactDeploymentRecords] ALTER COLUMN [PerSiteStatus] nvarchar(max) NULL;
|
||||||
|
|
||||||
|
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||||
|
VALUES (N'20261203151127_WidenSystemArtifactPerSiteStatus', N'10.0.13');
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
+2313
File diff suppressed because it is too large
Load Diff
+38
@@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class WidenSystemArtifactPerSiteStatus : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PerSiteStatus",
|
||||||
|
table: "SystemArtifactDeploymentRecords",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(4000)",
|
||||||
|
oldMaxLength: 4000,
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PerSiteStatus",
|
||||||
|
table: "SystemArtifactDeploymentRecords",
|
||||||
|
type: "nvarchar(4000)",
|
||||||
|
maxLength: 4000,
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(max)",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -381,8 +381,7 @@ namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
|
|||||||
.HasColumnType("nvarchar(200)");
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
b.Property<string>("PerSiteStatus")
|
b.Property<string>("PerSiteStatus")
|
||||||
.HasMaxLength(4000)
|
.HasColumnType("nvarchar(max)");
|
||||||
.HasColumnType("nvarchar(4000)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user