diff --git a/src/Ordering.Infrastructure/Migrations/20230925222426_Initial.Designer.cs b/src/Ordering.Infrastructure/Migrations/20230925222426_Initial.Designer.cs deleted file mode 100644 index 00c1250..0000000 --- a/src/Ordering.Infrastructure/Migrations/20230925222426_Initial.Designer.cs +++ /dev/null @@ -1,332 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using eShop.Ordering.Infrastructure; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - [DbContext(typeof(OrderingContext))] - [Migration("20230925222426_Initial")] - partial class Initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0-rtm.23512.13") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.HasSequence("buyerseq", "ordering") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderitemseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderseq", "ordering") - .IncrementsBy(10); - - modelBuilder.HasSequence("paymentseq", "ordering") - .IncrementsBy(10); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "buyerseq", "ordering"); - - b.Property("IdentityGuid") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IdentityGuid") - .IsUnique(); - - b.ToTable("buyers", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.ToTable("cardtypes", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "paymentseq", "ordering"); - - b.Property("BuyerId") - .HasColumnType("integer"); - - b.Property("_alias") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("Alias"); - - b.Property("_cardHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("CardHolderName"); - - b.Property("_cardNumber") - .IsRequired() - .HasMaxLength(25) - .HasColumnType("character varying(25)") - .HasColumnName("CardNumber"); - - b.Property("_cardTypeId") - .HasColumnType("integer") - .HasColumnName("CardTypeId"); - - b.Property("_expiration") - .HasMaxLength(25) - .HasColumnType("timestamp with time zone") - .HasColumnName("Expiration"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("_cardTypeId"); - - b.ToTable("paymentmethods", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderseq", "ordering"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("_buyerId") - .HasColumnType("integer") - .HasColumnName("BuyerId"); - - b.Property("_orderDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("OrderDate"); - - b.Property("_orderStatusId") - .HasColumnType("integer") - .HasColumnName("OrderStatusId"); - - b.Property("_paymentMethodId") - .HasColumnType("integer") - .HasColumnName("PaymentMethodId"); - - b.HasKey("Id"); - - b.HasIndex("_buyerId"); - - b.HasIndex("_orderStatusId"); - - b.HasIndex("_paymentMethodId"); - - b.ToTable("orders", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderitemseq"); - - b.Property("OrderId") - .HasColumnType("integer"); - - b.Property("ProductId") - .HasColumnType("integer"); - - b.Property("_discount") - .HasColumnType("numeric") - .HasColumnName("Discount"); - - b.Property("_pictureUrl") - .HasColumnType("text") - .HasColumnName("PictureUrl"); - - b.Property("_productName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("ProductName"); - - b.Property("_unitPrice") - .HasColumnType("numeric") - .HasColumnName("UnitPrice"); - - b.Property("_units") - .HasColumnType("integer") - .HasColumnName("Units"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("orderItems", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.ToTable("orderstatus", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Infrastructure.Idempotency.ClientRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("requests", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany("PaymentMethods") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", "CardType") - .WithMany() - .HasForeignKey("_cardTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CardType"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany() - .HasForeignKey("_buyerId"); - - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderStatus", "OrderStatus") - .WithMany() - .HasForeignKey("_orderStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", null) - .WithMany() - .HasForeignKey("_paymentMethodId") - .OnDelete(DeleteBehavior.Restrict); - - b.OwnsOne(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "Address", b1 => - { - b1.Property("OrderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b1.Property("OrderId"), "orderseq", "ordering"); - - b1.Property("City") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnType("text"); - - b1.Property("State") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnType("text"); - - b1.Property("ZipCode") - .HasColumnType("text"); - - b1.HasKey("OrderId"); - - b1.ToTable("orders", "ordering"); - - b1.WithOwner() - .HasForeignKey("OrderId"); - }); - - b.Navigation("Address"); - - b.Navigation("OrderStatus"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", null) - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Navigation("PaymentMethods"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Navigation("OrderItems"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Ordering.Infrastructure/Migrations/20230925222426_Initial.cs b/src/Ordering.Infrastructure/Migrations/20230925222426_Initial.cs deleted file mode 100644 index d9ef198..0000000 --- a/src/Ordering.Infrastructure/Migrations/20230925222426_Initial.cs +++ /dev/null @@ -1,281 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "ordering"); - - migrationBuilder.CreateSequence( - name: "buyerseq", - schema: "ordering", - incrementBy: 10); - - migrationBuilder.CreateSequence( - name: "orderitemseq", - incrementBy: 10); - - migrationBuilder.CreateSequence( - name: "orderseq", - schema: "ordering", - incrementBy: 10); - - migrationBuilder.CreateSequence( - name: "paymentseq", - schema: "ordering", - incrementBy: 10); - - migrationBuilder.CreateTable( - name: "buyers", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false), - IdentityGuid = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Name = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_buyers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "cardtypes", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false, defaultValue: 1), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_cardtypes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "orderstatus", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false, defaultValue: 1), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_orderstatus", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "requests", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - Time = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_requests", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "paymentmethods", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false), - CardTypeId = table.Column(type: "integer", nullable: false), - BuyerId = table.Column(type: "integer", nullable: false), - Alias = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - CardHolderName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - CardNumber = table.Column(type: "character varying(25)", maxLength: 25, nullable: false), - Expiration = table.Column(type: "timestamp with time zone", maxLength: 25, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_paymentmethods", x => x.Id); - table.ForeignKey( - name: "FK_paymentmethods_buyers_BuyerId", - column: x => x.BuyerId, - principalSchema: "ordering", - principalTable: "buyers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_paymentmethods_cardtypes_CardTypeId", - column: x => x.CardTypeId, - principalSchema: "ordering", - principalTable: "cardtypes", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "orders", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false), - Address_Street = table.Column(type: "text", nullable: true), - Address_City = table.Column(type: "text", nullable: true), - Address_State = table.Column(type: "text", nullable: true), - Address_Country = table.Column(type: "text", nullable: true), - Address_ZipCode = table.Column(type: "text", nullable: true), - OrderStatusId = table.Column(type: "integer", nullable: false), - Description = table.Column(type: "text", nullable: true), - BuyerId = table.Column(type: "integer", nullable: true), - OrderDate = table.Column(type: "timestamp with time zone", nullable: false), - PaymentMethodId = table.Column(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_orders", x => x.Id); - table.ForeignKey( - name: "FK_orders_buyers_BuyerId", - column: x => x.BuyerId, - principalSchema: "ordering", - principalTable: "buyers", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_orders_orderstatus_OrderStatusId", - column: x => x.OrderStatusId, - principalSchema: "ordering", - principalTable: "orderstatus", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_orders_paymentmethods_PaymentMethodId", - column: x => x.PaymentMethodId, - principalSchema: "ordering", - principalTable: "paymentmethods", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "orderItems", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false), - ProductId = table.Column(type: "integer", nullable: false), - OrderId = table.Column(type: "integer", nullable: false), - Discount = table.Column(type: "numeric", nullable: false), - PictureUrl = table.Column(type: "text", nullable: true), - ProductName = table.Column(type: "text", nullable: false), - UnitPrice = table.Column(type: "numeric", nullable: false), - Units = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_orderItems", x => x.Id); - table.ForeignKey( - name: "FK_orderItems_orders_OrderId", - column: x => x.OrderId, - principalSchema: "ordering", - principalTable: "orders", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_buyers_IdentityGuid", - schema: "ordering", - table: "buyers", - column: "IdentityGuid", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_orderItems_OrderId", - schema: "ordering", - table: "orderItems", - column: "OrderId"); - - migrationBuilder.CreateIndex( - name: "IX_orders_BuyerId", - schema: "ordering", - table: "orders", - column: "BuyerId"); - - migrationBuilder.CreateIndex( - name: "IX_orders_OrderStatusId", - schema: "ordering", - table: "orders", - column: "OrderStatusId"); - - migrationBuilder.CreateIndex( - name: "IX_orders_PaymentMethodId", - schema: "ordering", - table: "orders", - column: "PaymentMethodId"); - - migrationBuilder.CreateIndex( - name: "IX_paymentmethods_BuyerId", - schema: "ordering", - table: "paymentmethods", - column: "BuyerId"); - - migrationBuilder.CreateIndex( - name: "IX_paymentmethods_CardTypeId", - schema: "ordering", - table: "paymentmethods", - column: "CardTypeId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "orderItems", - schema: "ordering"); - - migrationBuilder.DropTable( - name: "requests", - schema: "ordering"); - - migrationBuilder.DropTable( - name: "orders", - schema: "ordering"); - - migrationBuilder.DropTable( - name: "orderstatus", - schema: "ordering"); - - migrationBuilder.DropTable( - name: "paymentmethods", - schema: "ordering"); - - migrationBuilder.DropTable( - name: "buyers", - schema: "ordering"); - - migrationBuilder.DropTable( - name: "cardtypes", - schema: "ordering"); - - migrationBuilder.DropSequence( - name: "buyerseq", - schema: "ordering"); - - migrationBuilder.DropSequence( - name: "orderitemseq"); - - migrationBuilder.DropSequence( - name: "orderseq", - schema: "ordering"); - - migrationBuilder.DropSequence( - name: "paymentseq", - schema: "ordering"); - } - } -} diff --git a/src/Ordering.Infrastructure/Migrations/20231021004633_FixOrderitemseqSchema.Designer.cs b/src/Ordering.Infrastructure/Migrations/20231021004633_FixOrderitemseqSchema.Designer.cs deleted file mode 100644 index 95d9378..0000000 --- a/src/Ordering.Infrastructure/Migrations/20231021004633_FixOrderitemseqSchema.Designer.cs +++ /dev/null @@ -1,329 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using eShop.Ordering.Infrastructure; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - [DbContext(typeof(OrderingContext))] - [Migration("20231021004633_FixOrderitemseqSchema")] - partial class FixOrderitemseqSchema - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("ordering") - .HasAnnotation("ProductVersion", "8.0.0-rtm.23512.13") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.HasSequence("buyerseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderitemseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("paymentseq") - .IncrementsBy(10); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "buyerseq"); - - b.Property("IdentityGuid") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IdentityGuid") - .IsUnique(); - - b.ToTable("buyers", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", b => - { - b.Property("Id") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.ToTable("cardtypes", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "paymentseq"); - - b.Property("BuyerId") - .HasColumnType("integer"); - - b.Property("_alias") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("Alias"); - - b.Property("_cardHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("CardHolderName"); - - b.Property("_cardNumber") - .IsRequired() - .HasMaxLength(25) - .HasColumnType("character varying(25)") - .HasColumnName("CardNumber"); - - b.Property("_cardTypeId") - .HasColumnType("integer") - .HasColumnName("CardTypeId"); - - b.Property("_expiration") - .HasMaxLength(25) - .HasColumnType("timestamp with time zone") - .HasColumnName("Expiration"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("_cardTypeId"); - - b.ToTable("paymentmethods", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderseq"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("_buyerId") - .HasColumnType("integer") - .HasColumnName("BuyerId"); - - b.Property("_orderDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("OrderDate"); - - b.Property("_orderStatusId") - .HasColumnType("integer") - .HasColumnName("OrderStatusId"); - - b.Property("_paymentMethodId") - .HasColumnType("integer") - .HasColumnName("PaymentMethodId"); - - b.HasKey("Id"); - - b.HasIndex("_buyerId"); - - b.HasIndex("_orderStatusId"); - - b.HasIndex("_paymentMethodId"); - - b.ToTable("orders", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderitemseq"); - - b.Property("OrderId") - .HasColumnType("integer"); - - b.Property("ProductId") - .HasColumnType("integer"); - - b.Property("_discount") - .HasColumnType("numeric") - .HasColumnName("Discount"); - - b.Property("_pictureUrl") - .HasColumnType("text") - .HasColumnName("PictureUrl"); - - b.Property("_productName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("ProductName"); - - b.Property("_unitPrice") - .HasColumnType("numeric") - .HasColumnName("UnitPrice"); - - b.Property("_units") - .HasColumnType("integer") - .HasColumnName("Units"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("orderItems", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.ToTable("orderstatus", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Infrastructure.Idempotency.ClientRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("requests", "ordering"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany("PaymentMethods") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", "CardType") - .WithMany() - .HasForeignKey("_cardTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CardType"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany() - .HasForeignKey("_buyerId"); - - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderStatus", "OrderStatus") - .WithMany() - .HasForeignKey("_orderStatusId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", null) - .WithMany() - .HasForeignKey("_paymentMethodId") - .OnDelete(DeleteBehavior.Restrict); - - b.OwnsOne(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "Address", b1 => - { - b1.Property("OrderId") - .HasColumnType("integer"); - - b1.Property("City") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnType("text"); - - b1.Property("State") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnType("text"); - - b1.Property("ZipCode") - .HasColumnType("text"); - - b1.HasKey("OrderId"); - - b1.ToTable("orders", "ordering"); - - b1.WithOwner() - .HasForeignKey("OrderId"); - }); - - b.Navigation("Address") - .IsRequired(); - - b.Navigation("OrderStatus"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.HasOne(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", null) - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Navigation("PaymentMethods"); - }); - - modelBuilder.Entity(" eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Navigation("OrderItems"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Ordering.Infrastructure/Migrations/20231021004633_FixOrderitemseqSchema.cs b/src/Ordering.Infrastructure/Migrations/20231021004633_FixOrderitemseqSchema.cs deleted file mode 100644 index e46f672..0000000 --- a/src/Ordering.Infrastructure/Migrations/20231021004633_FixOrderitemseqSchema.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - /// - public partial class FixOrderitemseqSchema : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameSequence( - name: "orderitemseq", - newName: "orderitemseq", - newSchema: "ordering"); - - migrationBuilder.AlterColumn( - name: "Id", - schema: "ordering", - table: "orderstatus", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldDefaultValue: 1); - - migrationBuilder.AlterColumn( - name: "Id", - schema: "ordering", - table: "cardtypes", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldDefaultValue: 1); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameSequence( - name: "orderitemseq", - schema: "ordering", - newName: "orderitemseq"); - - migrationBuilder.AlterColumn( - name: "Id", - schema: "ordering", - table: "orderstatus", - type: "integer", - nullable: false, - defaultValue: 1, - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "Id", - schema: "ordering", - table: "cardtypes", - type: "integer", - nullable: false, - defaultValue: 1, - oldClrType: typeof(int), - oldType: "integer"); - } - } -} diff --git a/src/Ordering.Infrastructure/Migrations/20240106121712_UseEnumForOrderStatus.Designer.cs b/src/Ordering.Infrastructure/Migrations/20240106121712_UseEnumForOrderStatus.Designer.cs deleted file mode 100644 index eca2e1d..0000000 --- a/src/Ordering.Infrastructure/Migrations/20240106121712_UseEnumForOrderStatus.Designer.cs +++ /dev/null @@ -1,336 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using eShop.Ordering.Infrastructure; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - [DbContext(typeof(OrderingContext))] - [Migration("20240106121712_UseEnumForOrderStatus")] - partial class UseEnumForOrderStatus - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("ordering") - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.HasSequence("buyerseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderitemseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("paymentseq") - .IncrementsBy(10); - - modelBuilder.Entity("eShop.IntegrationEventLogEF.IntegrationEventLogEntry", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EventTypeName") - .IsRequired() - .HasColumnType("text"); - - b.Property("State") - .HasColumnType("integer"); - - b.Property("TimesSent") - .HasColumnType("integer"); - - b.Property("TransactionId") - .HasColumnType("uuid"); - - b.HasKey("EventId"); - - b.ToTable("IntegrationEventLog", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "buyerseq"); - - b.Property("IdentityGuid") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IdentityGuid") - .IsUnique(); - - b.ToTable("buyers", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", b => - { - b.Property("Id") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.ToTable("cardtypes", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "paymentseq"); - - b.Property("BuyerId") - .HasColumnType("integer"); - - b.Property("_alias") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("Alias"); - - b.Property("_cardHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("CardHolderName"); - - b.Property("_cardNumber") - .IsRequired() - .HasMaxLength(25) - .HasColumnType("character varying(25)") - .HasColumnName("CardNumber"); - - b.Property("_cardTypeId") - .HasColumnType("integer") - .HasColumnName("CardTypeId"); - - b.Property("_expiration") - .HasMaxLength(25) - .HasColumnType("timestamp with time zone") - .HasColumnName("Expiration"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("_cardTypeId"); - - b.ToTable("paymentmethods", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderseq"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("OrderStatus") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("_buyerId") - .HasColumnType("integer") - .HasColumnName("BuyerId"); - - b.Property("_orderDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("OrderDate"); - - b.Property("_paymentMethodId") - .HasColumnType("integer") - .HasColumnName("PaymentMethodId"); - - b.HasKey("Id"); - - b.HasIndex("_buyerId"); - - b.HasIndex("_paymentMethodId"); - - b.ToTable("orders", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderitemseq"); - - b.Property("OrderId") - .HasColumnType("integer"); - - b.Property("ProductId") - .HasColumnType("integer"); - - b.Property("_discount") - .HasColumnType("numeric") - .HasColumnName("Discount"); - - b.Property("_pictureUrl") - .HasColumnType("text") - .HasColumnName("PictureUrl"); - - b.Property("_productName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("ProductName"); - - b.Property("_unitPrice") - .HasColumnType("numeric") - .HasColumnName("UnitPrice"); - - b.Property("_units") - .HasColumnType("integer") - .HasColumnName("Units"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("orderItems", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Infrastructure.Idempotency.ClientRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("requests", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany("PaymentMethods") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", "CardType") - .WithMany() - .HasForeignKey("_cardTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CardType"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany() - .HasForeignKey("_buyerId"); - - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", null) - .WithMany() - .HasForeignKey("_paymentMethodId") - .OnDelete(DeleteBehavior.Restrict); - - b.OwnsOne("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "Address", b1 => - { - b1.Property("OrderId") - .HasColumnType("integer"); - - b1.Property("City") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnType("text"); - - b1.Property("State") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnType("text"); - - b1.Property("ZipCode") - .HasColumnType("text"); - - b1.HasKey("OrderId"); - - b1.ToTable("orders", "ordering"); - - b1.WithOwner() - .HasForeignKey("OrderId"); - }); - - b.Navigation("Address") - .IsRequired(); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.HasOne("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", null) - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Navigation("PaymentMethods"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Navigation("OrderItems"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Ordering.Infrastructure/Migrations/20240106121712_UseEnumForOrderStatus.cs b/src/Ordering.Infrastructure/Migrations/20240106121712_UseEnumForOrderStatus.cs deleted file mode 100644 index be90508..0000000 --- a/src/Ordering.Infrastructure/Migrations/20240106121712_UseEnumForOrderStatus.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - /// - public partial class UseEnumForOrderStatus : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "OrderStatus", - schema: "ordering", - table: "orders", - type: "character varying(30)", - maxLength: 30, - nullable: false, - defaultValue: ""); - - // ensure "OrderStatus" column is populated before dropping the "orderstatus" table: - migrationBuilder.Sql(""" - UPDATE ordering.orders - SET "OrderStatus" = s."Name" - FROM ordering.orderstatus s - WHERE s."Id" = orders."OrderStatusId"; - """); - - migrationBuilder.DropForeignKey( - name: "FK_orders_orderstatus_OrderStatusId", - schema: "ordering", - table: "orders"); - - migrationBuilder.DropTable( - name: "orderstatus", - schema: "ordering"); - - migrationBuilder.DropIndex( - name: "IX_orders_OrderStatusId", - schema: "ordering", - table: "orders"); - - migrationBuilder.DropColumn( - name: "OrderStatusId", - schema: "ordering", - table: "orders"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "OrderStatusId", - schema: "ordering", - table: "orders", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateTable( - name: "orderstatus", - schema: "ordering", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_orderstatus", x => x.Id); - }); - - // ensure "orderstatus" table is seeded & "OrderStatusId" column is populated before dropping the "OrderStatus" column: - migrationBuilder.Sql(""" - INSERT INTO ordering.orderstatus("Id","Name") VALUES - (1, 'Submitted'), - (2, 'AwaitingValidation'), - (3, 'StockConfirmed'), - (4, 'Paid'), - (5, 'Shipped'), - (6, 'Cancelled'); - - UPDATE ordering.orders - SET "OrderStatusId" = s."Id" - FROM ordering.orderstatus s - WHERE s."Name" = orders."OrderStatus"; - """); - - migrationBuilder.DropColumn( - name: "OrderStatus", - schema: "ordering", - table: "orders"); - - migrationBuilder.CreateIndex( - name: "IX_orders_OrderStatusId", - schema: "ordering", - table: "orders", - column: "OrderStatusId"); - - migrationBuilder.AddForeignKey( - name: "FK_orders_orderstatus_OrderStatusId", - schema: "ordering", - table: "orders", - column: "OrderStatusId", - principalSchema: "ordering", - principalTable: "orderstatus", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/src/Ordering.Infrastructure/Migrations/OrderingContextModelSnapshot.cs b/src/Ordering.Infrastructure/Migrations/OrderingContextModelSnapshot.cs deleted file mode 100644 index cd26856..0000000 --- a/src/Ordering.Infrastructure/Migrations/OrderingContextModelSnapshot.cs +++ /dev/null @@ -1,333 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using eShop.Ordering.Infrastructure; - -#nullable disable - -namespace Ordering.Infrastructure.Migrations -{ - [DbContext(typeof(OrderingContext))] - partial class OrderingContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("ordering") - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.HasSequence("buyerseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderitemseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("orderseq") - .IncrementsBy(10); - - modelBuilder.HasSequence("paymentseq") - .IncrementsBy(10); - - modelBuilder.Entity("eShop.IntegrationEventLogEF.IntegrationEventLogEntry", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EventTypeName") - .IsRequired() - .HasColumnType("text"); - - b.Property("State") - .HasColumnType("integer"); - - b.Property("TimesSent") - .HasColumnType("integer"); - - b.Property("TransactionId") - .HasColumnType("uuid"); - - b.HasKey("EventId"); - - b.ToTable("IntegrationEventLog", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "buyerseq"); - - b.Property("IdentityGuid") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IdentityGuid") - .IsUnique(); - - b.ToTable("buyers", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", b => - { - b.Property("Id") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.ToTable("cardtypes", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "paymentseq"); - - b.Property("BuyerId") - .HasColumnType("integer"); - - b.Property("_alias") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("Alias"); - - b.Property("_cardHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("CardHolderName"); - - b.Property("_cardNumber") - .IsRequired() - .HasMaxLength(25) - .HasColumnType("character varying(25)") - .HasColumnName("CardNumber"); - - b.Property("_cardTypeId") - .HasColumnType("integer") - .HasColumnName("CardTypeId"); - - b.Property("_expiration") - .HasMaxLength(25) - .HasColumnType("timestamp with time zone") - .HasColumnName("Expiration"); - - b.HasKey("Id"); - - b.HasIndex("BuyerId"); - - b.HasIndex("_cardTypeId"); - - b.ToTable("paymentmethods", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderseq"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("OrderStatus") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("_buyerId") - .HasColumnType("integer") - .HasColumnName("BuyerId"); - - b.Property("_orderDate") - .HasColumnType("timestamp with time zone") - .HasColumnName("OrderDate"); - - b.Property("_paymentMethodId") - .HasColumnType("integer") - .HasColumnName("PaymentMethodId"); - - b.HasKey("Id"); - - b.HasIndex("_buyerId"); - - b.HasIndex("_paymentMethodId"); - - b.ToTable("orders", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "orderitemseq"); - - b.Property("OrderId") - .HasColumnType("integer"); - - b.Property("ProductId") - .HasColumnType("integer"); - - b.Property("_discount") - .HasColumnType("numeric") - .HasColumnName("Discount"); - - b.Property("_pictureUrl") - .HasColumnType("text") - .HasColumnName("PictureUrl"); - - b.Property("_productName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("ProductName"); - - b.Property("_unitPrice") - .HasColumnType("numeric") - .HasColumnName("UnitPrice"); - - b.Property("_units") - .HasColumnType("integer") - .HasColumnName("Units"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.ToTable("orderItems", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Infrastructure.Idempotency.ClientRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("requests", "ordering"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => - { - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany("PaymentMethods") - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", "CardType") - .WithMany() - .HasForeignKey("_cardTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CardType"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", null) - .WithMany() - .HasForeignKey("_buyerId"); - - b.HasOne("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", null) - .WithMany() - .HasForeignKey("_paymentMethodId") - .OnDelete(DeleteBehavior.Restrict); - - b.OwnsOne("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "Address", b1 => - { - b1.Property("OrderId") - .HasColumnType("integer"); - - b1.Property("City") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnType("text"); - - b1.Property("State") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnType("text"); - - b1.Property("ZipCode") - .HasColumnType("text"); - - b1.HasKey("OrderId"); - - b1.ToTable("orders", "ordering"); - - b1.WithOwner() - .HasForeignKey("OrderId"); - }); - - b.Navigation("Address") - .IsRequired(); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => - { - b.HasOne("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", null) - .WithMany("OrderItems") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => - { - b.Navigation("PaymentMethods"); - }); - - modelBuilder.Entity("eShop.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => - { - b.Navigation("OrderItems"); - }); -#pragma warning restore 612, 618 - } - } -}