From 77540caf2968dc35e1b6446c6feb61f00cda7c46 Mon Sep 17 00:00:00 2001 From: Matthias Beerens Date: Wed, 25 Jul 2018 21:07:04 +0200 Subject: [PATCH 1/2] Add max length and required constraints --- src/Infrastructure/Data/CatalogContext.cs | 31 +++ ...80725190153_AddExtraConstrains.Designer.cs | 244 ++++++++++++++++++ .../20180725190153_AddExtraConstrains.cs | 104 ++++++++ .../Migrations/CatalogContextModelSnapshot.cs | 174 +++++++------ 4 files changed, 475 insertions(+), 78 deletions(-) create mode 100644 src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs create mode 100644 src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs diff --git a/src/Infrastructure/Data/CatalogContext.cs b/src/Infrastructure/Data/CatalogContext.cs index e4b5d17..69dca05 100644 --- a/src/Infrastructure/Data/CatalogContext.cs +++ b/src/Infrastructure/Data/CatalogContext.cs @@ -28,6 +28,37 @@ namespace Microsoft.eShopWeb.Infrastructure.Data builder.Entity(ConfigureCatalogItem); builder.Entity(ConfigureOrder); builder.Entity(ConfigureOrderItem); + builder.Entity
(ConfigureAddress); + builder.Entity(ConfigurateCatalogItemOrdered); + } + + private void ConfigurateCatalogItemOrdered(EntityTypeBuilder builder) + { + builder.Property(cio => cio.ProductName) + .HasMaxLength(50) + .IsRequired(); + } + + private void ConfigureAddress(EntityTypeBuilder
builder) + { + builder.Property(a => a.ZipCode) + .HasMaxLength(18) + .IsRequired(); + + builder.Property(a => a.Street) + .HasMaxLength(180) + .IsRequired(); + + builder.Property(a => a.State) + .HasMaxLength(60); + + builder.Property(a => a.Country) + .HasMaxLength(90) + .IsRequired(); + + builder.Property(a => a.City) + .HasMaxLength(189) + .IsRequired(); } private void ConfigureBasket(EntityTypeBuilder builder) diff --git a/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs new file mode 100644 index 0000000..c513f9b --- /dev/null +++ b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs @@ -0,0 +1,244 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Microsoft.eShopWeb.Infrastructure.Data; + +namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations +{ + [DbContext(typeof(CatalogContext))] + [Migration("20180725190153_AddExtraConstrains")] + partial class AddExtraConstrains + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BuyerId"); + + b.HasKey("Id"); + + b.ToTable("Baskets"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BasketId"); + + b.Property("CatalogItemId"); + + b.Property("Quantity"); + + b.Property("UnitPrice"); + + b.HasKey("Id"); + + b.HasIndex("BasketId"); + + b.ToTable("BasketItem"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Brand") + .IsRequired() + .HasMaxLength(100); + + b.HasKey("Id"); + + b.ToTable("CatalogBrand"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("CatalogBrandId"); + + b.Property("CatalogTypeId"); + + b.Property("Description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50); + + b.Property("PictureUri"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.HasIndex("CatalogBrandId"); + + b.HasIndex("CatalogTypeId"); + + b.ToTable("Catalog"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Type") + .IsRequired() + .HasMaxLength(100); + + b.HasKey("Id"); + + b.ToTable("CatalogType"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BuyerId"); + + b.Property("OrderDate"); + + b.HasKey("Id"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("OrderId"); + + b.Property("UnitPrice"); + + b.Property("Units"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.ToTable("OrderItems"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b => + { + b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket") + .WithMany("Items") + .HasForeignKey("BasketId"); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b => + { + b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand") + .WithMany() + .HasForeignKey("CatalogBrandId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType") + .WithMany() + .HasForeignKey("CatalogTypeId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => + { + b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 => + { + b1.Property("OrderId") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("City") + .IsRequired() + .HasMaxLength(189); + + b1.Property("Country") + .IsRequired() + .HasMaxLength(90); + + b1.Property("State") + .HasMaxLength(60); + + b1.Property("Street") + .IsRequired() + .HasMaxLength(180); + + b1.Property("ZipCode") + .IsRequired() + .HasMaxLength(18); + + b1.ToTable("Orders"); + + b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order") + .WithOne("ShipToAddress") + .HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId") + .OnDelete(DeleteBehavior.Cascade); + }); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b => + { + b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order") + .WithMany("OrderItems") + .HasForeignKey("OrderId"); + + b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 => + { + b1.Property("OrderItemId") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("CatalogItemId"); + + b1.Property("PictureUri"); + + b1.Property("ProductName") + .IsRequired() + .HasMaxLength(50); + + b1.ToTable("OrderItems"); + + b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem") + .WithOne("ItemOrdered") + .HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId") + .OnDelete(DeleteBehavior.Cascade); + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs new file mode 100644 index 0000000..08c38df --- /dev/null +++ b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs @@ -0,0 +1,104 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations +{ + public partial class AddExtraConstrains : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ShipToAddress_ZipCode", + table: "Orders", + maxLength: 18, + nullable: false, + oldClrType: typeof(string), + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_Street", + table: "Orders", + maxLength: 180, + nullable: false, + oldClrType: typeof(string), + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_State", + table: "Orders", + maxLength: 60, + nullable: true, + oldClrType: typeof(string), + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_Country", + table: "Orders", + maxLength: 90, + nullable: false, + oldClrType: typeof(string), + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_City", + table: "Orders", + maxLength: 189, + nullable: false, + oldClrType: typeof(string), + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ItemOrdered_ProductName", + table: "OrderItems", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldNullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ShipToAddress_ZipCode", + table: "Orders", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 18); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_Street", + table: "Orders", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 180); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_State", + table: "Orders", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 60, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_Country", + table: "Orders", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 90); + + migrationBuilder.AlterColumn( + name: "ShipToAddress_City", + table: "Orders", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 189); + + migrationBuilder.AlterColumn( + name: "ItemOrdered_ProductName", + table: "OrderItems", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 50); + } + } +} diff --git a/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs b/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs index da98574..d60bf5f 100644 --- a/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs +++ b/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs @@ -1,12 +1,10 @@ // -using Microsoft.eShopWeb.Infrastructure.Data; +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage; -using Microsoft.EntityFrameworkCore.Storage.Internal; -using System; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Microsoft.eShopWeb.Infrastructure.Data; namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations { @@ -17,48 +15,18 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.0.0-rtm-26452") + .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") + .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'") .HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'") .HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.Order", b => + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b => { b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("BuyerId"); - - b.Property("OrderDate"); - - b.HasKey("Id"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("OrderId"); - - b.Property("UnitPrice"); - - b.Property("Units"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderItems"); - }); - - modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.Basket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property("BuyerId"); @@ -67,10 +35,11 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations b.ToTable("Baskets"); }); - modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b => + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property("BasketId"); @@ -149,59 +118,43 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations b.ToTable("CatalogType"); }); - modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.Order", b => + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => { - b.OwnsOne("ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 => - { - b1.Property("OrderId"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b1.Property("City"); + b.Property("BuyerId"); - b1.Property("Country"); + b.Property("OrderDate"); - b1.Property("State"); + b.HasKey("Id"); - b1.Property("Street"); - - b1.Property("ZipCode"); - - b1.ToTable("Orders"); - - b1.HasOne("ApplicationCore.Entities.OrderAggregate.Order") - .WithOne("ShipToAddress") - .HasForeignKey("ApplicationCore.Entities.OrderAggregate.Address", "OrderId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.ToTable("Orders"); }); - modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.OrderItem", b => + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b => { - b.HasOne("ApplicationCore.Entities.OrderAggregate.Order") - .WithMany("OrderItems") - .HasForeignKey("OrderId"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.OwnsOne("ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 => - { - b1.Property("OrderItemId"); + b.Property("OrderId"); - b1.Property("CatalogItemId"); + b.Property("UnitPrice"); - b1.Property("PictureUri"); + b.Property("Units"); - b1.Property("ProductName"); + b.HasKey("Id"); - b1.ToTable("OrderItems"); + b.HasIndex("OrderId"); - b1.HasOne("ApplicationCore.Entities.OrderAggregate.OrderItem") - .WithOne("ItemOrdered") - .HasForeignKey("ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.ToTable("OrderItems"); }); - modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b => + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b => { - b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.Basket") + b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket") .WithMany("Items") .HasForeignKey("BasketId"); }); @@ -218,6 +171,71 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations .HasForeignKey("CatalogTypeId") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => + { + b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 => + { + b1.Property("OrderId") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("City") + .IsRequired() + .HasMaxLength(189); + + b1.Property("Country") + .IsRequired() + .HasMaxLength(90); + + b1.Property("State") + .HasMaxLength(60); + + b1.Property("Street") + .IsRequired() + .HasMaxLength(180); + + b1.Property("ZipCode") + .IsRequired() + .HasMaxLength(18); + + b1.ToTable("Orders"); + + b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order") + .WithOne("ShipToAddress") + .HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId") + .OnDelete(DeleteBehavior.Cascade); + }); + }); + + modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b => + { + b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order") + .WithMany("OrderItems") + .HasForeignKey("OrderId"); + + b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 => + { + b1.Property("OrderItemId") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("CatalogItemId"); + + b1.Property("PictureUri"); + + b1.Property("ProductName") + .IsRequired() + .HasMaxLength(50); + + b1.ToTable("OrderItems"); + + b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem") + .WithOne("ItemOrdered") + .HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId") + .OnDelete(DeleteBehavior.Cascade); + }); + }); #pragma warning restore 612, 618 } } From 9c65c4e3f7681ca990566e9a44e73d3da683b905 Mon Sep 17 00:00:00 2001 From: Eric Fleming Date: Tue, 22 Jan 2019 20:28:56 -0500 Subject: [PATCH 2/2] Updates to existing PR - updating City value to be 100 instead of 189. The longest city name in the world is 85 characters long, so making it 100 just in case. - Fixed typo in file name: constrains to constraints --- src/Infrastructure/Data/CatalogContext.cs | 2 +- ....cs => 20180725190153_AddExtraConstraints.Designer.cs} | 8 +++----- ...onstrains.cs => 20180725190153_AddExtraConstraints.cs} | 6 +++--- .../Data/Migrations/CatalogContextModelSnapshot.cs | 4 +--- 4 files changed, 8 insertions(+), 12 deletions(-) rename src/Infrastructure/Data/Migrations/{20180725190153_AddExtraConstrains.Designer.cs => 20180725190153_AddExtraConstraints.Designer.cs} (97%) rename src/Infrastructure/Data/Migrations/{20180725190153_AddExtraConstrains.cs => 20180725190153_AddExtraConstraints.cs} (96%) diff --git a/src/Infrastructure/Data/CatalogContext.cs b/src/Infrastructure/Data/CatalogContext.cs index 69dca05..d775509 100644 --- a/src/Infrastructure/Data/CatalogContext.cs +++ b/src/Infrastructure/Data/CatalogContext.cs @@ -57,7 +57,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data .IsRequired(); builder.Property(a => a.City) - .HasMaxLength(189) + .HasMaxLength(100) .IsRequired(); } diff --git a/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstraints.Designer.cs similarity index 97% rename from src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs rename to src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstraints.Designer.cs index c513f9b..8f3b25b 100644 --- a/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs +++ b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstraints.Designer.cs @@ -4,14 +4,12 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Microsoft.eShopWeb.Infrastructure.Data; namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations { [DbContext(typeof(CatalogContext))] - [Migration("20180725190153_AddExtraConstrains")] - partial class AddExtraConstrains + [Migration("20180725190153_AddExtraConstraints")] + partial class AddExtraConstraints { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -184,7 +182,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations b1.Property("City") .IsRequired() - .HasMaxLength(189); + .HasMaxLength(100); b1.Property("Country") .IsRequired() diff --git a/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstraints.cs similarity index 96% rename from src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs rename to src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstraints.cs index 08c38df..d07c3fa 100644 --- a/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.cs +++ b/src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstraints.cs @@ -2,7 +2,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations { - public partial class AddExtraConstrains : Migration + public partial class AddExtraConstraints : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -41,7 +41,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations migrationBuilder.AlterColumn( name: "ShipToAddress_City", table: "Orders", - maxLength: 189, + maxLength: 100, nullable: false, oldClrType: typeof(string), oldNullable: true); @@ -91,7 +91,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations table: "Orders", nullable: true, oldClrType: typeof(string), - oldMaxLength: 189); + oldMaxLength: 100); migrationBuilder.AlterColumn( name: "ItemOrdered_ProductName", diff --git a/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs b/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs index d60bf5f..03cd76e 100644 --- a/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs +++ b/src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs @@ -3,8 +3,6 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Microsoft.eShopWeb.Infrastructure.Data; namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations { @@ -182,7 +180,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations b1.Property("City") .IsRequired() - .HasMaxLength(189); + .HasMaxLength(100); b1.Property("Country") .IsRequired()