From 65bae08201e90e78bd6244a52c329a7add3cd39e Mon Sep 17 00:00:00 2001 From: Timo Notheisen <65653426+tnotheis@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:11:28 +0200 Subject: [PATCH] Increase maximum size of external event sync item's error code to 100 (#840) * feat: increase max length of error code to 100 * feat: add migrations --- ...xternalEventSyncSyncRunCommandValidator.cs | 2 +- ...xSizeOfSyncErrorErrorCodeTo100.Designer.cs | 315 ++++++++++++++++++ ...ncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs | 40 +++ .../SynchronizationDbContextModelSnapshot.cs | 4 +- ...xSizeOfSyncErrorErrorCodeTo100.Designer.cs | 315 ++++++++++++++++++ ...ncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs | 40 +++ .../SynchronizationDbContextModelSnapshot.cs | 4 +- .../SyncErrorEntityTypeConfiguration.cs | 2 +- 8 files changed, 716 insertions(+), 6 deletions(-) create mode 100644 Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs create mode 100644 Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs create mode 100644 Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs create mode 100644 Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs diff --git a/Modules/Synchronization/src/Synchronization.Application/SyncRuns/Commands/FinalizeSyncRun/FinalizeExternalEventSyncSyncRunCommandValidator.cs b/Modules/Synchronization/src/Synchronization.Application/SyncRuns/Commands/FinalizeSyncRun/FinalizeExternalEventSyncSyncRunCommandValidator.cs index 508b890483..b9f472091d 100644 --- a/Modules/Synchronization/src/Synchronization.Application/SyncRuns/Commands/FinalizeSyncRun/FinalizeExternalEventSyncSyncRunCommandValidator.cs +++ b/Modules/Synchronization/src/Synchronization.Application/SyncRuns/Commands/FinalizeSyncRun/FinalizeExternalEventSyncSyncRunCommandValidator.cs @@ -20,7 +20,7 @@ public class EventResultValidator : AbstractValidator i.ExternalEventId).ValidId(); - RuleFor(i => i.ErrorCode).MaximumLength(50); + RuleFor(i => i.ErrorCode).MaximumLength(100); } } } diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs new file mode 100644 index 0000000000..d72d0e934c --- /dev/null +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs @@ -0,0 +1,315 @@ +// +using System; +using Backbone.Modules.Synchronization.Infrastructure.Persistence.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Backbone.Modules.Synchronization.Infrastructure.Database.Postgres.Migrations +{ + [DbContext(typeof(SynchronizationDbContext))] + [Migration("20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100")] + partial class IncreaseMaxSizeOfSyncErrorErrorCodeTo100 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Synchronization") + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Datawallet", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("Owner") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)") + .IsFixedLength(false); + + b.Property("Version") + .IsUnicode(false) + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("Owner") + .IsUnique(); + + b.ToTable("Datawallets", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.DatawalletModification", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("Collection") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)") + .IsFixedLength(false); + + b.Property("CreatedByDevice") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("DatawalletId") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("DatawalletVersion") + .IsUnicode(false) + .HasColumnType("integer"); + + b.Property("EncryptedPayload") + .HasColumnType("bytea"); + + b.Property("Index") + .HasColumnType("bigint"); + + b.Property("ObjectIdentifier") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PayloadCategory") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DatawalletId"); + + b.HasIndex("CreatedBy", "Index") + .IsUnique(); + + b.ToTable("DatawalletModifications", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Index") + .HasColumnType("bigint"); + + b.Property("Owner") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)") + .IsFixedLength(false); + + b.Property("Payload") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SyncErrorCount") + .HasColumnType("smallint"); + + b.Property("SyncRunId") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("SyncRunId"); + + b.HasIndex("Owner", "Index") + .IsUnique(); + + b.HasIndex("Owner", "SyncRunId"); + + b.ToTable("ExternalEvents", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncError", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("ErrorCode") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ExternalEventId") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("SyncRunId") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.HasKey("Id"); + + b.HasIndex("ExternalEventId"); + + b.HasIndex("SyncRunId", "ExternalEventId") + .IsUnique(); + + b.ToTable("SyncErrors", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)") + .IsFixedLength(false); + + b.Property("CreatedByDevice") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character(20)") + .IsFixedLength(); + + b.Property("EventCount") + .HasColumnType("integer"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("FinalizedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Index") + .HasColumnType("bigint"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy", "FinalizedAt"); + + b.HasIndex("CreatedBy", "Index") + .IsUnique(); + + b.ToTable("SyncRuns", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.DatawalletModification", b => + { + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Datawallet", "Datawallet") + .WithMany("Modifications") + .HasForeignKey("DatawalletId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Datawallet"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", b => + { + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", "SyncRun") + .WithMany("ExternalEvents") + .HasForeignKey("SyncRunId"); + + b.Navigation("SyncRun"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncError", b => + { + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", null) + .WithMany("Errors") + .HasForeignKey("ExternalEventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", null) + .WithMany("Errors") + .HasForeignKey("SyncRunId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Datawallet", b => + { + b.Navigation("Modifications"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", b => + { + b.Navigation("Errors"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", b => + { + b.Navigation("Errors"); + + b.Navigation("ExternalEvents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs new file mode 100644 index 0000000000..083fbb20dc --- /dev/null +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/20240904100328_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Backbone.Modules.Synchronization.Infrastructure.Database.Postgres.Migrations +{ + /// + public partial class IncreaseMaxSizeOfSyncErrorErrorCodeTo100 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ErrorCode", + schema: "Synchronization", + table: "SyncErrors", + type: "character varying(100)", + maxLength: 100, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(50)", + oldMaxLength: 50); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ErrorCode", + schema: "Synchronization", + table: "SyncErrors", + type: "character varying(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(100)", + oldMaxLength: 100); + } + } +} diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/SynchronizationDbContextModelSnapshot.cs b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/SynchronizationDbContextModelSnapshot.cs index 2ca3f8dbec..4297397e33 100644 --- a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/SynchronizationDbContextModelSnapshot.cs +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Migrations/SynchronizationDbContextModelSnapshot.cs @@ -179,8 +179,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ErrorCode") .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("ExternalEventId") .IsRequired() diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs new file mode 100644 index 0000000000..c933973091 --- /dev/null +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.Designer.cs @@ -0,0 +1,315 @@ +// +using System; +using Backbone.Modules.Synchronization.Infrastructure.Persistence.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Backbone.Modules.Synchronization.Infrastructure.Database.SqlServer.Migrations +{ + [DbContext(typeof(SynchronizationDbContext))] + [Migration("20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100")] + partial class IncreaseMaxSizeOfSyncErrorErrorCodeTo100 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Synchronization") + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Datawallet", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("Owner") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("varchar(80)") + .IsFixedLength(false); + + b.Property("Version") + .IsUnicode(false) + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Owner") + .IsUnique(); + + b.ToTable("Datawallets", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.DatawalletModification", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("Collection") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("varchar(80)") + .IsFixedLength(false); + + b.Property("CreatedByDevice") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("DatawalletId") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("DatawalletVersion") + .IsUnicode(false) + .HasColumnType("int"); + + b.Property("EncryptedPayload") + .HasColumnType("varbinary(max)"); + + b.Property("Index") + .HasColumnType("bigint"); + + b.Property("ObjectIdentifier") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PayloadCategory") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DatawalletId"); + + b.HasIndex("CreatedBy", "Index") + .IsUnique(); + + b.ToTable("DatawalletModifications", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Index") + .HasColumnType("bigint"); + + b.Property("Owner") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("varchar(80)") + .IsFixedLength(false); + + b.Property("Payload") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("SyncErrorCount") + .HasColumnType("tinyint"); + + b.Property("SyncRunId") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SyncRunId"); + + b.HasIndex("Owner", "Index") + .IsUnique(); + + b.HasIndex("Owner", "SyncRunId"); + + b.ToTable("ExternalEvents", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncError", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("ErrorCode") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExternalEventId") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("SyncRunId") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.HasKey("Id"); + + b.HasIndex("ExternalEventId"); + + b.HasIndex("SyncRunId", "ExternalEventId") + .IsUnique(); + + b.ToTable("SyncErrors", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", b => + { + b.Property("Id") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("varchar(80)") + .IsFixedLength(false); + + b.Property("CreatedByDevice") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("char(20)") + .IsFixedLength(); + + b.Property("EventCount") + .HasColumnType("int"); + + b.Property("ExpiresAt") + .HasColumnType("datetime2"); + + b.Property("FinalizedAt") + .HasColumnType("datetime2"); + + b.Property("Index") + .HasColumnType("bigint"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy", "FinalizedAt"); + + b.HasIndex("CreatedBy", "Index") + .IsUnique(); + + b.ToTable("SyncRuns", "Synchronization"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.DatawalletModification", b => + { + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Datawallet", "Datawallet") + .WithMany("Modifications") + .HasForeignKey("DatawalletId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Datawallet"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", b => + { + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", "SyncRun") + .WithMany("ExternalEvents") + .HasForeignKey("SyncRunId"); + + b.Navigation("SyncRun"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncError", b => + { + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", null) + .WithMany("Errors") + .HasForeignKey("ExternalEventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", null) + .WithMany("Errors") + .HasForeignKey("SyncRunId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Datawallet", b => + { + b.Navigation("Modifications"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.ExternalEvent", b => + { + b.Navigation("Errors"); + }); + + modelBuilder.Entity("Backbone.Modules.Synchronization.Domain.Entities.Sync.SyncRun", b => + { + b.Navigation("Errors"); + + b.Navigation("ExternalEvents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs new file mode 100644 index 0000000000..500d70aaa9 --- /dev/null +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/20240904100325_IncreaseMaxSizeOfSyncErrorErrorCodeTo100.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Backbone.Modules.Synchronization.Infrastructure.Database.SqlServer.Migrations +{ + /// + public partial class IncreaseMaxSizeOfSyncErrorErrorCodeTo100 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ErrorCode", + schema: "Synchronization", + table: "SyncErrors", + type: "nvarchar(100)", + maxLength: 100, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(50)", + oldMaxLength: 50); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ErrorCode", + schema: "Synchronization", + table: "SyncErrors", + type: "nvarchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(100)", + oldMaxLength: 100); + } + } +} diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/SynchronizationDbContextModelSnapshot.cs b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/SynchronizationDbContextModelSnapshot.cs index 3743842175..3411479ec8 100644 --- a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/SynchronizationDbContextModelSnapshot.cs +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Migrations/SynchronizationDbContextModelSnapshot.cs @@ -179,8 +179,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ErrorCode") .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ExternalEventId") .IsRequired() diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure/Persistence/Database/Configurations/SyncErrorEntityTypeConfiguration.cs b/Modules/Synchronization/src/Synchronization.Infrastructure/Persistence/Database/Configurations/SyncErrorEntityTypeConfiguration.cs index c6d7826db5..b2689b47e7 100644 --- a/Modules/Synchronization/src/Synchronization.Infrastructure/Persistence/Database/Configurations/SyncErrorEntityTypeConfiguration.cs +++ b/Modules/Synchronization/src/Synchronization.Infrastructure/Persistence/Database/Configurations/SyncErrorEntityTypeConfiguration.cs @@ -14,6 +14,6 @@ public override void Configure(EntityTypeBuilder builder) builder.HasKey(x => x.Id); - builder.Property(x => x.ErrorCode).HasMaxLength(50); + builder.Property(x => x.ErrorCode).HasMaxLength(100); } }