Migrated database changes after refactoring the Notification model

This commit is contained in:
Khwezi Mngoma
2026-05-10 15:27:26 +02:00
parent 394429677e
commit e8e9a85c57
20 changed files with 244 additions and 777 deletions
@@ -1,631 +0,0 @@
// <auto-generated />
using System;
using LiteCharms.Infrastructure.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LiteCharms.Infrastructure.Database.Migrations
{
[DbContext(typeof(ShopDbContext))]
[Migration("20260510090446_Init")]
partial class Init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LiteCharms.Entities.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("Active")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property<string>("Address")
.HasColumnType("text");
b.Property<string>("City")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("Country")
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<string>("Discord")
.HasColumnType("text");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkedIn")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Phone")
.HasColumnType("text");
b.Property<string>("PostalCode")
.HasColumnType("text");
b.Property<string>("Region")
.HasColumnType("text");
b.Property<string>("Slack")
.HasColumnType("text");
b.Property<string>("Tax")
.HasColumnType("text");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.Property<string>("Website")
.HasColumnType("text");
b.Property<string>("Whatsapp")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Customer", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.Lead", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<long?>("AdGroupId")
.HasColumnType("bigint");
b.Property<long?>("AdName")
.HasColumnType("bigint");
b.Property<string>("AppClickId")
.HasColumnType("text");
b.Property<string>("AttributionHash")
.IsRequired()
.HasColumnType("text");
b.Property<long?>("CampaignId")
.HasColumnType("bigint");
b.Property<string>("ClickId")
.HasColumnType("text");
b.Property<string>("ClickLocation")
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("CustomerId")
.HasColumnType("uuid");
b.Property<long?>("FeedItemId")
.HasColumnType("bigint");
b.Property<string>("Source")
.HasColumnType("text");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<long?>("TargetId")
.HasColumnType("bigint");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.Property<string>("WebClickId")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Lead", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.Notification", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("CorrelationId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("CorrelationIdType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<int>("Direction")
.HasColumnType("integer");
b.Property<bool>("IsHtml")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<bool>("IsInternal")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Platform")
.HasColumnType("integer");
b.Property<int>("Priority")
.HasColumnType("integer");
b.Property<bool>("Processed")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<string>("Recipient")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RecipientAddress")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Sender")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SenderName")
.HasColumnType("text");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Notification", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.Order", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<Guid>("CustomerId")
.HasColumnType("uuid");
b.Property<bool>("DepositRequired")
.HasColumnType("boolean");
b.PrimitiveCollection<string>("Notes")
.HasColumnType("jsonb");
b.Property<Guid?>("QuoteId")
.HasColumnType("uuid");
b.Property<Guid?>("RefundId")
.HasColumnType("uuid");
b.PrimitiveCollection<string>("Requirements")
.HasColumnType("jsonb");
b.Property<Guid>("ShoppingCartId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.PrimitiveCollection<string>("Terms")
.HasColumnType("jsonb");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("QuoteId")
.IsUnique();
b.HasIndex("ShoppingCartId")
.IsUnique();
b.ToTable("Order", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<Guid>("OrderId")
.HasColumnType("uuid");
b.Property<string>("Reason")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("OrderId")
.IsUnique();
b.ToTable("OrderRefund", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.Product", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("Active")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Product", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("Active")
.HasColumnType("boolean");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<decimal>("Discount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property<decimal>("Price")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ProductId");
b.ToTable("ProductPrice", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.Quote", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<Guid>("CustomerId")
.HasColumnType("uuid");
b.Property<Guid?>("CustomerId1")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("ExpiredAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Reason")
.HasColumnType("text");
b.Property<Guid>("ShoppingCartId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("CustomerId1");
b.HasIndex("ShoppingCartId")
.IsUnique();
b.ToTable("Quote", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.ShoppingCart", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("CustomerId")
.HasColumnType("uuid");
b.Property<Guid?>("OrderId")
.HasColumnType("uuid");
b.Property<Guid?>("QuoteId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("ShoppingCart", (string)null);
});
modelBuilder.Entity("LiteCharms.Entities.ShoppingCartItem", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("ProductPriceId")
.HasColumnType("uuid");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.Property<Guid>("ShoppingCartId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ProductPriceId");
b.HasIndex("ShoppingCartId");
b.ToTable("ShoppingCartItems");
});
modelBuilder.Entity("LiteCharms.Entities.Lead", b =>
{
b.HasOne("LiteCharms.Entities.Customer", "Customer")
.WithMany("Leads")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.NoAction);
b.Navigation("Customer");
});
modelBuilder.Entity("LiteCharms.Entities.Order", b =>
{
b.HasOne("LiteCharms.Entities.Customer", "Customer")
.WithMany("Orders")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("LiteCharms.Entities.Quote", "Quote")
.WithOne("Order")
.HasForeignKey("LiteCharms.Entities.Order", "QuoteId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart")
.WithOne("Order")
.HasForeignKey("LiteCharms.Entities.Order", "ShoppingCartId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("Customer");
b.Navigation("Quote");
b.Navigation("ShoppingCart");
});
modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b =>
{
b.HasOne("LiteCharms.Entities.Order", "Order")
.WithOne("Refund")
.HasForeignKey("LiteCharms.Entities.OrderRefund", "OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
});
modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b =>
{
b.HasOne("LiteCharms.Entities.Product", "Product")
.WithMany("ProductPrices")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("LiteCharms.Entities.Quote", b =>
{
b.HasOne("LiteCharms.Entities.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiteCharms.Entities.Customer", null)
.WithMany("Quotes")
.HasForeignKey("CustomerId1");
b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart")
.WithOne("Quote")
.HasForeignKey("LiteCharms.Entities.Quote", "ShoppingCartId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("Customer");
b.Navigation("ShoppingCart");
});
modelBuilder.Entity("LiteCharms.Entities.ShoppingCart", b =>
{
b.HasOne("LiteCharms.Entities.Customer", "Customer")
.WithMany("ShoppingCarts")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.NoAction);
b.Navigation("Customer");
});
modelBuilder.Entity("LiteCharms.Entities.ShoppingCartItem", b =>
{
b.HasOne("LiteCharms.Entities.ProductPrice", "ProductPrice")
.WithMany()
.HasForeignKey("ProductPriceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart")
.WithMany("ShoppingCartItems")
.HasForeignKey("ShoppingCartId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ProductPrice");
b.Navigation("ShoppingCart");
});
modelBuilder.Entity("LiteCharms.Entities.Customer", b =>
{
b.Navigation("Leads");
b.Navigation("Orders");
b.Navigation("Quotes");
b.Navigation("ShoppingCarts");
});
modelBuilder.Entity("LiteCharms.Entities.Order", b =>
{
b.Navigation("Refund");
});
modelBuilder.Entity("LiteCharms.Entities.Product", b =>
{
b.Navigation("ProductPrices");
});
modelBuilder.Entity("LiteCharms.Entities.Quote", b =>
{
b.Navigation("Order");
});
modelBuilder.Entity("LiteCharms.Entities.ShoppingCart", b =>
{
b.Navigation("Order");
b.Navigation("Quote");
b.Navigation("ShoppingCartItems");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,114 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiteCharms.Infrastructure.Database.Migrations
{
/// <inheritdoc />
public partial class AddedPackages : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Package",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
Active = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Package", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PackageItem",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
PackageId1 = table.Column<Guid>(type: "uuid", nullable: true),
PackageId = table.Column<Guid>(type: "uuid", nullable: false),
ProductPriceId = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Active = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PackageItem", x => x.Id);
table.ForeignKey(
name: "FK_PackageItem_Package_PackageId",
column: x => x.PackageId,
principalTable: "Package",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PackageItem_Package_PackageId1",
column: x => x.PackageId1,
principalTable: "Package",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ShoppingCartPackage",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: false),
PackageId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ShoppingCartPackage", x => x.Id);
table.ForeignKey(
name: "FK_ShoppingCartPackage_Package_PackageId",
column: x => x.PackageId,
principalTable: "Package",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ShoppingCartPackage_ShoppingCart_ShoppingCartId",
column: x => x.ShoppingCartId,
principalTable: "ShoppingCart",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_PackageItem_PackageId",
table: "PackageItem",
column: "PackageId");
migrationBuilder.CreateIndex(
name: "IX_PackageItem_PackageId1",
table: "PackageItem",
column: "PackageId1");
migrationBuilder.CreateIndex(
name: "IX_ShoppingCartPackage_PackageId",
table: "ShoppingCartPackage",
column: "PackageId");
migrationBuilder.CreateIndex(
name: "IX_ShoppingCartPackage_ShoppingCartId",
table: "ShoppingCartPackage",
column: "ShoppingCartId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PackageItem");
migrationBuilder.DropTable(
name: "ShoppingCartPackage");
migrationBuilder.DropTable(
name: "Package");
}
}
}
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharms.Infrastructure.Database.Migrations
{
[DbContext(typeof(ShopDbContext))]
[Migration("20260510091540_AddedPackages")]
partial class AddedPackages
[Migration("20260510132008_Init")]
partial class Init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -171,9 +171,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("CorrelationIdType")
.IsRequired()
.HasColumnType("text");
b.Property<int>("CorrelationIdType")
.HasColumnType("integer");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
@@ -182,6 +181,14 @@ namespace LiteCharms.Infrastructure.Database.Migrations
b.Property<int>("Direction")
.HasColumnType("integer");
b.PrimitiveCollection<string>("Errors")
.HasColumnType("jsonb");
b.Property<bool>("HasError")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<bool>("IsHtml")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
@@ -339,12 +346,17 @@ namespace LiteCharms.Infrastructure.Database.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("ShoppingCartId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ShoppingCartId");
b.ToTable("Package", (string)null);
});
@@ -614,6 +626,13 @@ namespace LiteCharms.Infrastructure.Database.Migrations
b.Navigation("Order");
});
modelBuilder.Entity("LiteCharms.Entities.Package", b =>
{
b.HasOne("LiteCharms.Entities.ShoppingCart", null)
.WithMany("Packages")
.HasForeignKey("ShoppingCartId");
});
modelBuilder.Entity("LiteCharms.Entities.PackageItem", b =>
{
b.HasOne("LiteCharms.Entities.Package", "Package")
@@ -746,6 +765,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
{
b.Navigation("Order");
b.Navigation("Packages");
b.Navigation("Quote");
b.Navigation("ShoppingCartItems");
@@ -51,6 +51,7 @@ namespace LiteCharms.Infrastructure.Database.Migrations
Direction = table.Column<int>(type: "integer", nullable: false),
Platform = table.Column<int>(type: "integer", nullable: false),
Priority = table.Column<int>(type: "integer", nullable: false),
CorrelationIdType = table.Column<int>(type: "integer", nullable: false),
Sender = table.Column<string>(type: "text", nullable: false),
SenderName = table.Column<string>(type: "text", nullable: true),
Subject = table.Column<string>(type: "text", nullable: false),
@@ -58,10 +59,11 @@ namespace LiteCharms.Infrastructure.Database.Migrations
Recipient = table.Column<string>(type: "text", nullable: false),
RecipientAddress = table.Column<string>(type: "text", nullable: false),
CorrelationId = table.Column<string>(type: "text", nullable: false),
CorrelationIdType = table.Column<string>(type: "text", nullable: false),
IsHtml = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
IsInternal = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
Processed = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
Processed = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
HasError = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
Errors = table.Column<string>(type: "jsonb", nullable: true)
},
constraints: table =>
{
@@ -157,6 +159,28 @@ namespace LiteCharms.Infrastructure.Database.Migrations
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Package",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: true),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
Active = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Package", x => x.Id);
table.ForeignKey(
name: "FK_Package_ShoppingCart_ShoppingCartId",
column: x => x.ShoppingCartId,
principalTable: "ShoppingCart",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Quote",
columns: table => new
@@ -220,6 +244,56 @@ namespace LiteCharms.Infrastructure.Database.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PackageItem",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
PackageId1 = table.Column<Guid>(type: "uuid", nullable: true),
PackageId = table.Column<Guid>(type: "uuid", nullable: false),
ProductPriceId = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Active = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PackageItem", x => x.Id);
table.ForeignKey(
name: "FK_PackageItem_Package_PackageId",
column: x => x.PackageId,
principalTable: "Package",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PackageItem_Package_PackageId1",
column: x => x.PackageId1,
principalTable: "Package",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ShoppingCartPackage",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: false),
PackageId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ShoppingCartPackage", x => x.Id);
table.ForeignKey(
name: "FK_ShoppingCartPackage_Package_PackageId",
column: x => x.PackageId,
principalTable: "Package",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ShoppingCartPackage_ShoppingCart_ShoppingCartId",
column: x => x.ShoppingCartId,
principalTable: "ShoppingCart",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Order",
columns: table => new
@@ -308,6 +382,21 @@ namespace LiteCharms.Infrastructure.Database.Migrations
column: "OrderId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Package_ShoppingCartId",
table: "Package",
column: "ShoppingCartId");
migrationBuilder.CreateIndex(
name: "IX_PackageItem_PackageId",
table: "PackageItem",
column: "PackageId");
migrationBuilder.CreateIndex(
name: "IX_PackageItem_PackageId1",
table: "PackageItem",
column: "PackageId1");
migrationBuilder.CreateIndex(
name: "IX_ProductPrice_ProductId",
table: "ProductPrice",
@@ -343,6 +432,16 @@ namespace LiteCharms.Infrastructure.Database.Migrations
name: "IX_ShoppingCartItems_ShoppingCartId",
table: "ShoppingCartItems",
column: "ShoppingCartId");
migrationBuilder.CreateIndex(
name: "IX_ShoppingCartPackage_PackageId",
table: "ShoppingCartPackage",
column: "PackageId");
migrationBuilder.CreateIndex(
name: "IX_ShoppingCartPackage_ShoppingCartId",
table: "ShoppingCartPackage",
column: "ShoppingCartId");
}
/// <inheritdoc />
@@ -357,15 +456,24 @@ namespace LiteCharms.Infrastructure.Database.Migrations
migrationBuilder.DropTable(
name: "OrderRefund");
migrationBuilder.DropTable(
name: "PackageItem");
migrationBuilder.DropTable(
name: "ShoppingCartItems");
migrationBuilder.DropTable(
name: "ShoppingCartPackage");
migrationBuilder.DropTable(
name: "Order");
migrationBuilder.DropTable(
name: "ProductPrice");
migrationBuilder.DropTable(
name: "Package");
migrationBuilder.DropTable(
name: "Quote");
@@ -168,9 +168,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("CorrelationIdType")
.IsRequired()
.HasColumnType("text");
b.Property<int>("CorrelationIdType")
.HasColumnType("integer");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
@@ -179,6 +178,14 @@ namespace LiteCharms.Infrastructure.Database.Migrations
b.Property<int>("Direction")
.HasColumnType("integer");
b.PrimitiveCollection<string>("Errors")
.HasColumnType("jsonb");
b.Property<bool>("HasError")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<bool>("IsHtml")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
@@ -336,12 +343,17 @@ namespace LiteCharms.Infrastructure.Database.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("ShoppingCartId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("UpdatedAt")
.ValueGeneratedOnUpdate()
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ShoppingCartId");
b.ToTable("Package", (string)null);
});
@@ -611,6 +623,13 @@ namespace LiteCharms.Infrastructure.Database.Migrations
b.Navigation("Order");
});
modelBuilder.Entity("LiteCharms.Entities.Package", b =>
{
b.HasOne("LiteCharms.Entities.ShoppingCart", null)
.WithMany("Packages")
.HasForeignKey("ShoppingCartId");
});
modelBuilder.Entity("LiteCharms.Entities.PackageItem", b =>
{
b.HasOne("LiteCharms.Entities.Package", "Package")
@@ -743,6 +762,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
{
b.Navigation("Order");
b.Navigation("Packages");
b.Navigation("Quote");
b.Navigation("ShoppingCartItems");