diff --git a/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/20240531122945_ResizeAddressFields.Designer.cs b/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/20240531122945_ResizeAddressFields.Designer.cs new file mode 100644 index 0000000..4396e7b --- /dev/null +++ b/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/20240531122945_ResizeAddressFields.Designer.cs @@ -0,0 +1,547 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.QuoteModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.QuoteModule.Data.MySql.Migrations +{ + [DbContext(typeof(QuoteDbContext))] + [Migration("20240531122945_ResizeAddressFields")] + partial class ResizeAddressFields + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AttachmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("MimeType") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(2083) + .HasColumnType("varchar(2083)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteAttachment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime(6)"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("longtext"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("ObjectId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_QuoteDynamicPropertyObjectValue_ObjectType_ObjectId"); + + b.ToTable("QuoteDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("varchar(1028)"); + + b.Property("ListPrice") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("SalePrice") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasColumnType("longtext"); + + b.Property("Coupon") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("EnableNotification") + .HasColumnType("tinyint(1)"); + + b.Property("ExpirationDate") + .HasColumnType("datetime(6)"); + + b.Property("InnerComment") + .HasColumnType("longtext"); + + b.Property("IsAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsLocked") + .HasColumnType("tinyint(1)"); + + b.Property("IsSubmitted") + .HasColumnType("tinyint(1)"); + + b.Property("LanguageCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.Property("ManualRelDiscountAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ManualShippingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ManualSubTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ReminderDate") + .HasColumnType("datetime(6)"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Tag") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.ToTable("QuoteRequest", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.TierPriceEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Quantity") + .HasColumnType("bigint"); + + b.Property("QuoteItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteItemId"); + + b.ToTable("QuoteTierPrice", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Addresses") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AttachmentEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Attachments") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ObjectId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Items") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.TierPriceEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", "QuoteItem") + .WithMany("ProposalPrices") + .HasForeignKey("QuoteItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteItem"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.Navigation("ProposalPrices"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Attachments"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/20240531122945_ResizeAddressFields.cs b/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/20240531122945_ResizeAddressFields.cs new file mode 100644 index 0000000..6b12c30 --- /dev/null +++ b/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/20240531122945_ResizeAddressFields.cs @@ -0,0 +1,168 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.QuoteModule.Data.MySql.Migrations +{ + /// + public partial class ResizeAddressFields : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Organization", + table: "QuoteAddress", + type: "varchar(512)", + maxLength: 512, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(64)", + oldMaxLength: 64, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "QuoteAddress", + type: "varchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(64)", + oldMaxLength: 64) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "QuoteAddress", + type: "varchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(64)", + oldMaxLength: 64) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Email", + table: "QuoteAddress", + type: "varchar(256)", + maxLength: 256, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(254)", + oldMaxLength: 254, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "CountryName", + table: "QuoteAddress", + type: "varchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(64)", + oldMaxLength: 64) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "AddressType", + table: "QuoteAddress", + type: "varchar(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(32)", + oldMaxLength: 32, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Organization", + table: "QuoteAddress", + type: "varchar(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(512)", + oldMaxLength: 512, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "QuoteAddress", + type: "varchar(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(128)", + oldMaxLength: 128) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "QuoteAddress", + type: "varchar(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(128)", + oldMaxLength: 128) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Email", + table: "QuoteAddress", + type: "varchar(254)", + maxLength: 254, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(256)", + oldMaxLength: 256, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "CountryName", + table: "QuoteAddress", + type: "varchar(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(128)", + oldMaxLength: 128) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "AddressType", + table: "QuoteAddress", + type: "varchar(32)", + maxLength: 32, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(64)", + oldMaxLength: 64, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + } +} diff --git a/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/QuoteDbContextModelSnapshot.cs b/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/QuoteDbContextModelSnapshot.cs index 91bf022..472051e 100644 --- a/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/QuoteDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.QuoteModule.Data.MySql/Migrations/QuoteDbContextModelSnapshot.cs @@ -2,6 +2,7 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using VirtoCommerce.QuoteModule.Data.Repositories; @@ -16,9 +17,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("ProductVersion", "8.0.2") .HasAnnotation("Relational:MaxIdentifierLength", 64); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => { b.Property("Id") @@ -27,8 +30,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("varchar(128)"); b.Property("AddressType") - .HasMaxLength(32) - .HasColumnType("varchar(32)"); + .HasMaxLength(64) + .HasColumnType("varchar(64)"); b.Property("City") .IsRequired() @@ -41,22 +44,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CountryName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); + .HasMaxLength(128) + .HasColumnType("varchar(128)"); b.Property("Email") - .HasMaxLength(254) - .HasColumnType("varchar(254)"); + .HasMaxLength(256) + .HasColumnType("varchar(256)"); b.Property("FirstName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); + .HasMaxLength(128) + .HasColumnType("varchar(128)"); b.Property("LastName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); + .HasMaxLength(128) + .HasColumnType("varchar(128)"); b.Property("Line1") .HasMaxLength(2048) @@ -67,8 +70,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("varchar(2048)"); b.Property("Organization") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); + .HasMaxLength(512) + .HasColumnType("varchar(512)"); b.Property("OuterId") .HasMaxLength(128) diff --git a/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/20240531123024_ResizeAddressFields.Designer.cs b/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/20240531123024_ResizeAddressFields.Designer.cs new file mode 100644 index 0000000..20f3d7a --- /dev/null +++ b/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/20240531123024_ResizeAddressFields.Designer.cs @@ -0,0 +1,542 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using VirtoCommerce.QuoteModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.QuoteModule.Data.PostgreSql.Migrations +{ + [DbContext(typeof(QuoteDbContext))] + [Migration("20240531123024_ResizeAddressFields")] + partial class ResizeAddressFields + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AttachmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("MimeType") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(2083) + .HasColumnType("character varying(2083)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteAttachment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BooleanValue") + .HasColumnType("boolean"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DateTimeValue") + .HasColumnType("timestamp with time zone"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IntegerValue") + .HasColumnType("integer"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LongTextValue") + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("ObjectId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_QuoteDynamicPropertyObjectValue_ObjectType_ObjectId"); + + b.ToTable("QuoteDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("character varying(1028)"); + + b.Property("ListPrice") + .HasColumnType("Money"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("SalePrice") + .HasColumnType("Money"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Coupon") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("EnableNotification") + .HasColumnType("boolean"); + + b.Property("ExpirationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("InnerComment") + .HasColumnType("text"); + + b.Property("IsAnonymous") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsLocked") + .HasColumnType("boolean"); + + b.Property("IsSubmitted") + .HasColumnType("boolean"); + + b.Property("LanguageCode") + .HasMaxLength(5) + .HasColumnType("character varying(5)"); + + b.Property("ManualRelDiscountAmount") + .HasPrecision(18, 2) + .HasColumnType("numeric(18,2)"); + + b.Property("ManualShippingTotal") + .HasColumnType("Money"); + + b.Property("ManualSubTotal") + .HasColumnType("Money"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ReminderDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Tag") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.ToTable("QuoteRequest", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.TierPriceEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("Quantity") + .HasColumnType("bigint"); + + b.Property("QuoteItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteItemId"); + + b.ToTable("QuoteTierPrice", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Addresses") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AttachmentEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Attachments") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ObjectId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Items") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.TierPriceEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", "QuoteItem") + .WithMany("ProposalPrices") + .HasForeignKey("QuoteItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteItem"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.Navigation("ProposalPrices"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Attachments"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/20240531123024_ResizeAddressFields.cs b/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/20240531123024_ResizeAddressFields.cs new file mode 100644 index 0000000..88fd964 --- /dev/null +++ b/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/20240531123024_ResizeAddressFields.cs @@ -0,0 +1,144 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.QuoteModule.Data.PostgreSql.Migrations +{ + /// + public partial class ResizeAddressFields : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Organization", + table: "QuoteAddress", + type: "character varying(512)", + maxLength: 512, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(64)", + oldMaxLength: 64, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "QuoteAddress", + type: "character varying(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(64)", + oldMaxLength: 64); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "QuoteAddress", + type: "character varying(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(64)", + oldMaxLength: 64); + + migrationBuilder.AlterColumn( + name: "Email", + table: "QuoteAddress", + type: "character varying(256)", + maxLength: 256, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(254)", + oldMaxLength: 254, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CountryName", + table: "QuoteAddress", + type: "character varying(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(64)", + oldMaxLength: 64); + + migrationBuilder.AlterColumn( + name: "AddressType", + table: "QuoteAddress", + type: "character varying(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(32)", + oldMaxLength: 32, + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Organization", + table: "QuoteAddress", + type: "character varying(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(512)", + oldMaxLength: 512, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "QuoteAddress", + type: "character varying(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(128)", + oldMaxLength: 128); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "QuoteAddress", + type: "character varying(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(128)", + oldMaxLength: 128); + + migrationBuilder.AlterColumn( + name: "Email", + table: "QuoteAddress", + type: "character varying(254)", + maxLength: 254, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(256)", + oldMaxLength: 256, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CountryName", + table: "QuoteAddress", + type: "character varying(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(128)", + oldMaxLength: 128); + + migrationBuilder.AlterColumn( + name: "AddressType", + table: "QuoteAddress", + type: "character varying(32)", + maxLength: 32, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(64)", + oldMaxLength: 64, + oldNullable: true); + } + } +} diff --git a/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/QuoteDbContextModelSnapshot.cs b/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/QuoteDbContextModelSnapshot.cs index 0cf4e83..f0deb0d 100644 --- a/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/QuoteDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.QuoteModule.Data.PostgreSql/Migrations/QuoteDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("ProductVersion", "8.0.2") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -30,8 +30,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(128)"); b.Property("AddressType") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); + .HasMaxLength(64) + .HasColumnType("character varying(64)"); b.Property("City") .IsRequired() @@ -44,22 +44,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CountryName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Email") - .HasMaxLength(254) - .HasColumnType("character varying(254)"); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("FirstName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("LastName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Line1") .HasMaxLength(2048) @@ -70,8 +70,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(2048)"); b.Property("Organization") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasMaxLength(512) + .HasColumnType("character varying(512)"); b.Property("OuterId") .HasMaxLength(128) diff --git a/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/20240531123152_ResizeAddressFields.Designer.cs b/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/20240531123152_ResizeAddressFields.Designer.cs new file mode 100644 index 0000000..6fbeaff --- /dev/null +++ b/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/20240531123152_ResizeAddressFields.Designer.cs @@ -0,0 +1,542 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.QuoteModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.QuoteModule.Data.SqlServer.Migrations +{ + [DbContext(typeof(QuoteDbContext))] + [Migration("20240531123152_ResizeAddressFields")] + partial class ResizeAddressFields + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AttachmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("MimeType") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(2083) + .HasColumnType("nvarchar(2083)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteAttachment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("bit"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("DateTimeValue") + .HasColumnType("datetime2"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("ObjectId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_QuoteDynamicPropertyObjectValue_ObjectType_ObjectId"); + + b.ToTable("QuoteDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("nvarchar(1028)"); + + b.Property("ListPrice") + .HasColumnType("Money"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("QuoteRequestId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("SalePrice") + .HasColumnType("Money"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteRequestId"); + + b.ToTable("QuoteItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("Coupon") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EnableNotification") + .HasColumnType("bit"); + + b.Property("ExpirationDate") + .HasColumnType("datetime2"); + + b.Property("InnerComment") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAnonymous") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsLocked") + .HasColumnType("bit"); + + b.Property("IsSubmitted") + .HasColumnType("bit"); + + b.Property("LanguageCode") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("ManualRelDiscountAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ManualShippingTotal") + .HasColumnType("Money"); + + b.Property("ManualSubTotal") + .HasColumnType("Money"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ReminderDate") + .HasColumnType("datetime2"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Tag") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.ToTable("QuoteRequest", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.TierPriceEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("Quantity") + .HasColumnType("bigint"); + + b.Property("QuoteItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("QuoteItemId"); + + b.ToTable("QuoteTierPrice", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Addresses") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AttachmentEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Attachments") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ObjectId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", "QuoteRequest") + .WithMany("Items") + .HasForeignKey("QuoteRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteRequest"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.TierPriceEntity", b => + { + b.HasOne("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", "QuoteItem") + .WithMany("ProposalPrices") + .HasForeignKey("QuoteItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuoteItem"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteItemEntity", b => + { + b.Navigation("ProposalPrices"); + }); + + modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.QuoteRequestEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Attachments"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/20240531123152_ResizeAddressFields.cs b/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/20240531123152_ResizeAddressFields.cs new file mode 100644 index 0000000..4f8790c --- /dev/null +++ b/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/20240531123152_ResizeAddressFields.cs @@ -0,0 +1,144 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.QuoteModule.Data.SqlServer.Migrations +{ + /// + public partial class ResizeAddressFields : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Organization", + table: "QuoteAddress", + type: "nvarchar(512)", + maxLength: 512, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "QuoteAddress", + type: "nvarchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "QuoteAddress", + type: "nvarchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64); + + migrationBuilder.AlterColumn( + name: "Email", + table: "QuoteAddress", + type: "nvarchar(256)", + maxLength: 256, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(254)", + oldMaxLength: 254, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CountryName", + table: "QuoteAddress", + type: "nvarchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64); + + migrationBuilder.AlterColumn( + name: "AddressType", + table: "QuoteAddress", + type: "nvarchar(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(32)", + oldMaxLength: 32, + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Organization", + table: "QuoteAddress", + type: "nvarchar(64)", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(512)", + oldMaxLength: 512, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LastName", + table: "QuoteAddress", + type: "nvarchar(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(128)", + oldMaxLength: 128); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "QuoteAddress", + type: "nvarchar(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(128)", + oldMaxLength: 128); + + migrationBuilder.AlterColumn( + name: "Email", + table: "QuoteAddress", + type: "nvarchar(254)", + maxLength: 254, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(256)", + oldMaxLength: 256, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CountryName", + table: "QuoteAddress", + type: "nvarchar(64)", + maxLength: 64, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(128)", + oldMaxLength: 128); + + migrationBuilder.AlterColumn( + name: "AddressType", + table: "QuoteAddress", + type: "nvarchar(32)", + maxLength: 32, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(64)", + oldMaxLength: 64, + oldNullable: true); + } + } +} diff --git a/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/QuoteDbContextModelSnapshot.cs b/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/QuoteDbContextModelSnapshot.cs index 8a24635..6ac17f0 100644 --- a/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/QuoteDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.QuoteModule.Data.SqlServer/Migrations/QuoteDbContextModelSnapshot.cs @@ -30,8 +30,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("nvarchar(128)"); b.Property("AddressType") - .HasMaxLength(32) - .HasColumnType("nvarchar(32)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("City") .IsRequired() @@ -44,22 +44,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CountryName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Email") - .HasMaxLength(254) - .HasColumnType("nvarchar(254)"); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("FirstName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("LastName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Line1") .HasMaxLength(2048) @@ -70,8 +70,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("nvarchar(2048)"); b.Property("Organization") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("OuterId") .HasMaxLength(128) diff --git a/src/VirtoCommerce.QuoteModule.Data/Model/AddressEntity.cs b/src/VirtoCommerce.QuoteModule.Data/Model/AddressEntity.cs index 31efb01..41222dc 100644 --- a/src/VirtoCommerce.QuoteModule.Data/Model/AddressEntity.cs +++ b/src/VirtoCommerce.QuoteModule.Data/Model/AddressEntity.cs @@ -7,38 +7,52 @@ namespace VirtoCommerce.QuoteModule.Data.Model { public class AddressEntity : Entity, IHasOuterId { - [StringLength(32)] - public string AddressType { get; set; } [StringLength(64)] + public string AddressType { get; set; } + + [StringLength(512)] public string Organization { get; set; } + [StringLength(3)] public string CountryCode { get; set; } + [Required] - [StringLength(64)] + [StringLength(128)] public string CountryName { get; set; } + [Required] [StringLength(128)] public string City { get; set; } + [StringLength(64)] public string PostalCode { get; set; } + [StringLength(2048)] public string Line1 { get; set; } + [StringLength(2048)] public string Line2 { get; set; } + [StringLength(128)] public string RegionId { get; set; } + [StringLength(128)] public string RegionName { get; set; } + [Required] - [StringLength(64)] + [StringLength(128)] public string FirstName { get; set; } + [Required] - [StringLength(64)] + [StringLength(128)] public string LastName { get; set; } + [StringLength(64)] public string Phone { get; set; } - [StringLength(254)] + + [StringLength(256)] public string Email { get; set; } + [StringLength(128)] public string OuterId { get; set; }