committed by
GitHub
4 changed files with 452 additions and 28 deletions
@ -0,0 +1,315 @@ |
|||
// <auto-generated />
|
|||
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; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations |
|||
{ |
|||
[DbContext(typeof(CatalogContext))] |
|||
[Migration("20211231093753_FixShipToAddress")] |
|||
partial class FixShipToAddress |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "6.0.0") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128); |
|||
|
|||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); |
|||
|
|||
modelBuilder.HasSequence("catalog_brand_hilo") |
|||
.IncrementsBy(10); |
|||
|
|||
modelBuilder.HasSequence("catalog_hilo") |
|||
.IncrementsBy(10); |
|||
|
|||
modelBuilder.HasSequence("catalog_type_hilo") |
|||
.IncrementsBy(10); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); |
|||
|
|||
b.Property<string>("BuyerId") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("nvarchar(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("Baskets"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); |
|||
|
|||
b.Property<int>("BasketId") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("CatalogItemId") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("Quantity") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<decimal>("UnitPrice") |
|||
.HasColumnType("decimal(18,2)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("BasketId"); |
|||
|
|||
b.ToTable("BasketItems"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseHiLo(b.Property<int>("Id"), "catalog_brand_hilo"); |
|||
|
|||
b.Property<string>("Brand") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("nvarchar(100)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("CatalogBrands"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseHiLo(b.Property<int>("Id"), "catalog_hilo"); |
|||
|
|||
b.Property<int>("CatalogBrandId") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("CatalogTypeId") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(50) |
|||
.HasColumnType("nvarchar(50)"); |
|||
|
|||
b.Property<string>("PictureUri") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<decimal>("Price") |
|||
.HasColumnType("decimal(18,2)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("CatalogBrandId"); |
|||
|
|||
b.HasIndex("CatalogTypeId"); |
|||
|
|||
b.ToTable("Catalog", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseHiLo(b.Property<int>("Id"), "catalog_type_hilo"); |
|||
|
|||
b.Property<string>("Type") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("nvarchar(100)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("CatalogTypes"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); |
|||
|
|||
b.Property<string>("BuyerId") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("nvarchar(256)"); |
|||
|
|||
b.Property<DateTimeOffset>("OrderDate") |
|||
.HasColumnType("datetimeoffset"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("Orders"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); |
|||
|
|||
b.Property<int?>("OrderId") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<decimal>("UnitPrice") |
|||
.HasColumnType("decimal(18,2)"); |
|||
|
|||
b.Property<int>("Units") |
|||
.HasColumnType("int"); |
|||
|
|||
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", null) |
|||
.WithMany("Items") |
|||
.HasForeignKey("BasketId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b => |
|||
{ |
|||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand") |
|||
.WithMany() |
|||
.HasForeignKey("CatalogBrandId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType") |
|||
.WithMany() |
|||
.HasForeignKey("CatalogTypeId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("CatalogBrand"); |
|||
|
|||
b.Navigation("CatalogType"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => |
|||
{ |
|||
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 => |
|||
{ |
|||
b1.Property<int>("OrderId") |
|||
.HasColumnType("int"); |
|||
|
|||
b1.Property<string>("City") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("nvarchar(100)"); |
|||
|
|||
b1.Property<string>("Country") |
|||
.IsRequired() |
|||
.HasMaxLength(90) |
|||
.HasColumnType("nvarchar(90)"); |
|||
|
|||
b1.Property<string>("State") |
|||
.HasMaxLength(60) |
|||
.HasColumnType("nvarchar(60)"); |
|||
|
|||
b1.Property<string>("Street") |
|||
.IsRequired() |
|||
.HasMaxLength(180) |
|||
.HasColumnType("nvarchar(180)"); |
|||
|
|||
b1.Property<string>("ZipCode") |
|||
.IsRequired() |
|||
.HasMaxLength(18) |
|||
.HasColumnType("nvarchar(18)"); |
|||
|
|||
b1.HasKey("OrderId"); |
|||
|
|||
b1.ToTable("Orders"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderId"); |
|||
}); |
|||
|
|||
b.Navigation("ShipToAddress") |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b => |
|||
{ |
|||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", null) |
|||
.WithMany("OrderItems") |
|||
.HasForeignKey("OrderId"); |
|||
|
|||
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 => |
|||
{ |
|||
b1.Property<int>("OrderItemId") |
|||
.HasColumnType("int"); |
|||
|
|||
b1.Property<int>("CatalogItemId") |
|||
.HasColumnType("int"); |
|||
|
|||
b1.Property<string>("PictureUri") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b1.Property<string>("ProductName") |
|||
.IsRequired() |
|||
.HasMaxLength(50) |
|||
.HasColumnType("nvarchar(50)"); |
|||
|
|||
b1.HasKey("OrderItemId"); |
|||
|
|||
b1.ToTable("OrderItems"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderItemId"); |
|||
}); |
|||
|
|||
b.Navigation("ItemOrdered"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b => |
|||
{ |
|||
b.Navigation("Items"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b => |
|||
{ |
|||
b.Navigation("OrderItems"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,103 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations |
|||
{ |
|||
public partial class FixShipToAddress : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_ZipCode", |
|||
table: "Orders", |
|||
type: "nvarchar(18)", |
|||
maxLength: 18, |
|||
nullable: false, |
|||
defaultValue: "", |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(18)", |
|||
oldMaxLength: 18, |
|||
oldNullable: true); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_Street", |
|||
table: "Orders", |
|||
type: "nvarchar(180)", |
|||
maxLength: 180, |
|||
nullable: false, |
|||
defaultValue: "", |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(180)", |
|||
oldMaxLength: 180, |
|||
oldNullable: true); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_Country", |
|||
table: "Orders", |
|||
type: "nvarchar(90)", |
|||
maxLength: 90, |
|||
nullable: false, |
|||
defaultValue: "", |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(90)", |
|||
oldMaxLength: 90, |
|||
oldNullable: true); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_City", |
|||
table: "Orders", |
|||
type: "nvarchar(100)", |
|||
maxLength: 100, |
|||
nullable: false, |
|||
defaultValue: "", |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(100)", |
|||
oldMaxLength: 100, |
|||
oldNullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_ZipCode", |
|||
table: "Orders", |
|||
type: "nvarchar(18)", |
|||
maxLength: 18, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(18)", |
|||
oldMaxLength: 18); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_Street", |
|||
table: "Orders", |
|||
type: "nvarchar(180)", |
|||
maxLength: 180, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(180)", |
|||
oldMaxLength: 180); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_Country", |
|||
table: "Orders", |
|||
type: "nvarchar(90)", |
|||
maxLength: 90, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(90)", |
|||
oldMaxLength: 90); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "ShipToAddress_City", |
|||
table: "Orders", |
|||
type: "nvarchar(100)", |
|||
maxLength: 100, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(100)", |
|||
oldMaxLength: 100); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue