diff --git a/LiteCharms.Features/Extensions/Timezones.cs b/LiteCharms.Features/Extensions/Timezones.cs
index bbddd5d..3976240 100644
--- a/LiteCharms.Features/Extensions/Timezones.cs
+++ b/LiteCharms.Features/Extensions/Timezones.cs
@@ -23,5 +23,5 @@ public static class Timezones
return DateTimeOffset.Parse(localised!);
}
- public static DateTimeOffset UtcNow(this TimeZoneInfo timezone) => ToDateTimeWithTimeZone(DateTime.Now, timezone);
+ public static DateTime UtcNow(this TimeZoneInfo timezone) => ToDateTimeWithTimeZone(DateTime.Now, timezone).UtcDateTime;
}
diff --git a/LiteCharms.Features/LiteCharms.Features.csproj b/LiteCharms.Features/LiteCharms.Features.csproj
index 9ad7508..a9aedad 100644
--- a/LiteCharms.Features/LiteCharms.Features.csproj
+++ b/LiteCharms.Features/LiteCharms.Features.csproj
@@ -21,6 +21,7 @@
LICENSE
utility;dotnet
icon.png
+ 8a78916e-c86b-4f4b-9f4e-d8e7769b5d23
@@ -143,5 +144,13 @@
+
+
+ PreserveNewest
+
+
+
+
+
diff --git a/LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs b/LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs
index e6ff029..cfc89ff 100644
--- a/LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs
+++ b/LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs
@@ -8,7 +8,7 @@ public class PackageConfirguration : IEntityTypeConfiguration
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
- builder.Property(f => f.UpdatedAt).IsRequired(false);
+ builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
builder.Property(f => f.Name).IsRequired();
builder.Property(f => f.Summary).IsRequired().HasMaxLength(512);
builder.Property(f => f.Description).IsRequired().HasMaxLength(2048);
diff --git a/LiteCharms.Features/Shop/CartPackages/Models/Package.cs b/LiteCharms.Features/Shop/CartPackages/Models/Package.cs
index fcc560b..9d2e8b0 100644
--- a/LiteCharms.Features/Shop/CartPackages/Models/Package.cs
+++ b/LiteCharms.Features/Shop/CartPackages/Models/Package.cs
@@ -4,9 +4,9 @@ public class Package
{
public Guid Id { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
+ public DateTime CreatedAt { get; set; }
- public DateTimeOffset? UpdatedAt { get; set; }
+ public DateTime? UpdatedAt { get; set; }
public string? Name { get; set; }
diff --git a/LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs b/LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs
index 335c1b0..f5ce014 100644
--- a/LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs
+++ b/LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs
@@ -4,11 +4,11 @@ public class CustomerConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
- builder.ToTable(nameof(Customer));
+ builder.ToTable("Customers");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).ValueGeneratedOnAdd().HasDefaultValueSql("now()");
- builder.Property(f => f.UpdatedAt).IsRequired(false);
+ builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
builder.Property(f => f.Company);
builder.Property(f => f.Name).IsRequired();
builder.Property(f => f.LastName).IsRequired();
diff --git a/LiteCharms.Features/Shop/Customers/Models/Customer.cs b/LiteCharms.Features/Shop/Customers/Models/Customer.cs
index 14387f6..d4cec8c 100644
--- a/LiteCharms.Features/Shop/Customers/Models/Customer.cs
+++ b/LiteCharms.Features/Shop/Customers/Models/Customer.cs
@@ -4,9 +4,9 @@ public class Customer
{
public Guid Id { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
+ public DateTime CreatedAt { get; set; }
- public DateTimeOffset? UpdatedAt { get; set; }
+ public DateTime? UpdatedAt { get; set; }
public string? Company { get; set; }
diff --git a/LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs b/LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs
index 482677c..39a0a20 100644
--- a/LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs
+++ b/LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs
@@ -4,12 +4,12 @@ public class LeadConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
- builder.ToTable(nameof(Lead));
+ builder.ToTable("Leads");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).ValueGeneratedOnAdd().HasDefaultValueSql("now()");
- builder.Property(f => f.UpdatedAt).IsRequired(false);
- builder.Property(f => f.CustomerId).IsRequired(false);
+ builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
+ builder.Property(f => f.CustomerId);
builder.Property(f => f.Source);
builder.Property(f => f.ClickId);
builder.Property(f => f.WebClickId);
@@ -22,5 +22,10 @@ public class LeadConfiguration : IEntityTypeConfiguration
builder.Property(f => f.ClickLocation);
builder.Property(f => f.Status).IsRequired();
builder.Property(f => f.AttributionHash).IsRequired(true);
+
+ builder.HasOne(f => f.Customer)
+ .WithMany()
+ .HasForeignKey(f => f.CustomerId)
+ .OnDelete(DeleteBehavior.Restrict);
}
}
diff --git a/LiteCharms.Features/Shop/Leads/Models/Lead.cs b/LiteCharms.Features/Shop/Leads/Models/Lead.cs
index 0cb9fa1..adfb1ba 100644
--- a/LiteCharms.Features/Shop/Leads/Models/Lead.cs
+++ b/LiteCharms.Features/Shop/Leads/Models/Lead.cs
@@ -4,9 +4,9 @@ public class Lead
{
public Guid Id { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
+ public DateTime CreatedAt { get; set; }
- public DateTimeOffset? UpdatedAt { get; set; }
+ public DateTime? UpdatedAt { get; set; }
public Guid? CustomerId { get; set; }
diff --git a/LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs b/LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs
index 8a00b68..7139d0d 100644
--- a/LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs
+++ b/LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs
@@ -4,11 +4,11 @@ public class NotificationConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
- builder.ToTable(nameof(Notification));
+ builder.ToTable("Notification");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
- builder.Property(f => f.UpdatedAt).IsRequired(false);
+ builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
builder.Property(f => f.Direction).IsRequired().HasConversion();
builder.Property(f => f.Platform).IsRequired().HasConversion();
builder.Property(f => f.Priority).IsRequired().HasConversion();
diff --git a/LiteCharms.Features/Shop/Notifications/Models/Notification.cs b/LiteCharms.Features/Shop/Notifications/Models/Notification.cs
index bb9b77c..fd085a1 100644
--- a/LiteCharms.Features/Shop/Notifications/Models/Notification.cs
+++ b/LiteCharms.Features/Shop/Notifications/Models/Notification.cs
@@ -4,9 +4,9 @@ public class Notification
{
public Guid Id { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
+ public DateTime CreatedAt { get; set; }
- public DateTimeOffset? UpdatedAt { get; set; }
+ public DateTime? UpdatedAt { get; set; }
public NotificationDirection Direction { get; set; }
diff --git a/LiteCharms.Features/Shop/Notifications/NotificationService.cs b/LiteCharms.Features/Shop/Notifications/NotificationService.cs
index 84e7565..59493e4 100644
--- a/LiteCharms.Features/Shop/Notifications/NotificationService.cs
+++ b/LiteCharms.Features/Shop/Notifications/NotificationService.cs
@@ -31,7 +31,7 @@ public class NotificationService(IDbContextFactory contextFactory
Processed = false
});
- return newNotification is not null
+ return await context.SaveChangesAsync(cancellationToken) > 0
? Result.Ok(newNotification.Entity.Id)
: Result.Fail(new Error("Failed to create notification"));
}
diff --git a/LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs b/LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs
index d79fb0e..848aaed 100644
--- a/LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs
+++ b/LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs
@@ -4,11 +4,11 @@ public class OrderConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
- builder.ToTable(nameof(Order));
+ builder.ToTable("Orders");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).ValueGeneratedOnAdd().HasDefaultValueSql("now()");
- builder.Property(f => f.UpdatedAt).IsRequired(false);
+ builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
builder.Property(f => f.CustomerId).IsRequired();
builder.Property(f => f.Status).HasConversion().IsRequired();
builder.Property(f => f.Requirements).HasColumnType("jsonb").IsRequired(false);
diff --git a/LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs b/LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs
index 33591d7..8f7e462 100644
--- a/LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs
+++ b/LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs
@@ -3,5 +3,6 @@
[EntityTypeConfiguration]
public class OrderRefund : Models.OrderRefund
{
+
public virtual Order? Order { get; set; }
}
diff --git a/LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs b/LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs
index f353123..b33c2ee 100644
--- a/LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs
+++ b/LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs
@@ -4,7 +4,7 @@ public class OrderRefundConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
- builder.ToTable(nameof(OrderRefund));
+ builder.ToTable("OrderRefunds");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).ValueGeneratedOnAdd().HasDefaultValueSql("now()");
diff --git a/LiteCharms.Features/Shop/Orders/Models/Order.cs b/LiteCharms.Features/Shop/Orders/Models/Order.cs
index d093993..30bb75d 100644
--- a/LiteCharms.Features/Shop/Orders/Models/Order.cs
+++ b/LiteCharms.Features/Shop/Orders/Models/Order.cs
@@ -4,9 +4,9 @@ public class Order
{
public Guid Id { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
+ public DateTime CreatedAt { get; set; }
- public DateTimeOffset? UpdatedAt { get; set; }
+ public DateTime? UpdatedAt { get; set; }
public Guid CustomerId { get; set; }
diff --git a/LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs b/LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs
index 34668a7..1463afd 100644
--- a/LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs
+++ b/LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs
@@ -4,7 +4,7 @@ public class OrderRefund
{
public Guid Id { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
+ public DateTime CreatedAt { get; set; }
public Guid OrderId { get; set; }
diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs b/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs
new file mode 100644
index 0000000..b0185a2
--- /dev/null
+++ b/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs
@@ -0,0 +1,871 @@
+//
+using System;
+using LiteCharms.Features.Shop.Postgres;
+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.Features.Shop.Postgres.Migrations
+{
+ [DbContext(typeof(ShopDbContext))]
+ [Migration("20260514004002_UsedStringTableNames")]
+ partial class UsedStringTableNames
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "10.0.8")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.CartPackages.Entities.Package", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("ImageUrl")
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Summary")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("Package", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.CartPackages.Entities.PackageItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("PackageId")
+ .HasColumnType("uuid");
+
+ b.Property("ProductPriceId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PackageId");
+
+ b.HasIndex("ProductPriceId");
+
+ b.ToTable("PackageItem", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Customers.Entities.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Active")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(true);
+
+ b.Property("Address")
+ .HasColumnType("text");
+
+ b.Property("City")
+ .HasColumnType("text");
+
+ b.Property("Company")
+ .HasColumnType("text");
+
+ b.Property("Country")
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("Discord")
+ .HasColumnType("text");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("LinkedIn")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Phone")
+ .HasColumnType("text");
+
+ b.Property("PostalCode")
+ .HasColumnType("text");
+
+ b.Property("Region")
+ .HasColumnType("text");
+
+ b.Property("Slack")
+ .HasColumnType("text");
+
+ b.Property("Tax")
+ .HasColumnType("text");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Website")
+ .HasColumnType("text");
+
+ b.Property("Whatsapp")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Customers.Models.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("Address")
+ .HasColumnType("text");
+
+ b.Property("City")
+ .HasColumnType("text");
+
+ b.Property("Company")
+ .HasColumnType("text");
+
+ b.Property("Country")
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Discord")
+ .HasColumnType("text");
+
+ b.Property("Email")
+ .HasColumnType("text");
+
+ b.Property("LastName")
+ .HasColumnType("text");
+
+ b.Property("LinkedIn")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Phone")
+ .HasColumnType("text");
+
+ b.Property("PostalCode")
+ .HasColumnType("text");
+
+ b.Property("Region")
+ .HasColumnType("text");
+
+ b.Property("Slack")
+ .HasColumnType("text");
+
+ b.Property("Tax")
+ .HasColumnType("text");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Website")
+ .HasColumnType("text");
+
+ b.Property("Whatsapp")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Customer");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Leads.Entities.Lead", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("AdGroupId")
+ .HasColumnType("bigint");
+
+ b.Property("AdName")
+ .HasColumnType("bigint");
+
+ b.Property("AppClickId")
+ .HasColumnType("text");
+
+ b.Property("AttributionHash")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CampaignId")
+ .HasColumnType("bigint");
+
+ b.Property("ClickId")
+ .HasColumnType("text");
+
+ b.Property("ClickLocation")
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId1")
+ .HasColumnType("uuid");
+
+ b.Property("FeedItemId")
+ .HasColumnType("bigint");
+
+ b.Property("Source")
+ .HasColumnType("text");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("TargetId")
+ .HasColumnType("bigint");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("WebClickId")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("CustomerId1");
+
+ b.ToTable("Leads", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Notifications.Entities.Notification", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CorrelationId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CorrelationIdType")
+ .HasColumnType("integer");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("Direction")
+ .HasColumnType("integer");
+
+ b.PrimitiveCollection("Errors")
+ .HasColumnType("jsonb");
+
+ b.Property("HasError")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false);
+
+ b.Property("IsHtml")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false);
+
+ b.Property("IsInternal")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(true);
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Platform")
+ .HasColumnType("integer");
+
+ b.Property("Priority")
+ .HasColumnType("integer");
+
+ b.Property("Processed")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false);
+
+ b.Property("RecipientAddress")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("RecipientName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SenderAddress")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SenderName")
+ .HasColumnType("text");
+
+ b.Property("Subject")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("Notification", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Orders.Entities.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("InvoiceUrl")
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.PrimitiveCollection("Notes")
+ .HasColumnType("jsonb");
+
+ b.PrimitiveCollection("Requirements")
+ .HasColumnType("jsonb");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.PrimitiveCollection("Terms")
+ .HasColumnType("jsonb");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Orders", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Orders.Entities.OrderRefund", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Amount")
+ .HasPrecision(18, 2)
+ .HasColumnType("numeric(18,2)");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("OrderId")
+ .HasColumnType("uuid");
+
+ b.Property("Reason")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrderId");
+
+ b.ToTable("OrderRefunds", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Products.Entities.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Active")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(true);
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("ImageUrl")
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Summary")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.PrimitiveCollection("Thumbnails")
+ .HasColumnType("jsonb");
+
+ b.HasKey("Id");
+
+ b.ToTable("Products", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Products.Entities.ProductPrice", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("Discount")
+ .HasPrecision(18, 2)
+ .HasColumnType("numeric(18,2)");
+
+ b.Property("Price")
+ .HasPrecision(18, 2)
+ .HasColumnType("numeric(18,2)");
+
+ b.Property("ProductId")
+ .HasColumnType("uuid");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("ProductPrices", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Quotes.Entities.Quote", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("ExpiredAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("InvoiceUrl")
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("OrderId")
+ .HasColumnType("uuid");
+
+ b.Property("Reason")
+ .HasColumnType("text");
+
+ b.Property("ShoppingCartId")
+ .HasColumnType("uuid");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("OrderId")
+ .IsUnique();
+
+ b.HasIndex("ShoppingCartId")
+ .IsUnique();
+
+ b.ToTable("Quotes", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("OrderId")
+ .HasColumnType("uuid");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("OrderId")
+ .IsUnique();
+
+ b.ToTable("ShoppingCarts", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCartItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("ProductPriceId")
+ .HasColumnType("uuid");
+
+ b.Property("ProductPriceId1")
+ .HasColumnType("uuid");
+
+ b.Property("Quantity")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasDefaultValue(1);
+
+ b.Property("ShoppingCartId")
+ .HasColumnType("uuid");
+
+ b.Property("ShoppingCartId1")
+ .HasColumnType("uuid");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductPriceId");
+
+ b.HasIndex("ProductPriceId1");
+
+ b.HasIndex("ShoppingCartId");
+
+ b.HasIndex("ShoppingCartId1");
+
+ b.ToTable("ShoppingCartItems", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCartPackage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("now()");
+
+ b.Property("PackageId")
+ .HasColumnType("uuid");
+
+ b.Property("ShoppingCartId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PackageId");
+
+ b.HasIndex("ShoppingCartId");
+
+ b.ToTable("ShoppingCartPackages", (string)null);
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.CartPackages.Entities.PackageItem", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.CartPackages.Entities.Package", "Package")
+ .WithMany("PackageItems")
+ .HasForeignKey("PackageId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("LiteCharms.Features.Shop.Products.Entities.ProductPrice", "ProductPrice")
+ .WithMany()
+ .HasForeignKey("ProductPriceId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("Package");
+
+ b.Navigation("ProductPrice");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Leads.Entities.Lead", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Customers.Models.Customer", "Customer")
+ .WithMany()
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Restrict);
+
+ b.HasOne("LiteCharms.Features.Shop.Customers.Entities.Customer", null)
+ .WithMany("Leads")
+ .HasForeignKey("CustomerId1");
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Orders.Entities.Order", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Customers.Entities.Customer", "Customer")
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Orders.Entities.OrderRefund", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Orders.Entities.Order", "Order")
+ .WithMany("Refunds")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Products.Entities.ProductPrice", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Products.Entities.Product", "Product")
+ .WithMany("ProductPrices")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Quotes.Entities.Quote", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Customers.Entities.Customer", "Customer")
+ .WithMany("Quotes")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("LiteCharms.Features.Shop.Orders.Entities.Order", "Order")
+ .WithOne("Quote")
+ .HasForeignKey("LiteCharms.Features.Shop.Quotes.Entities.Quote", "OrderId");
+
+ b.HasOne("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", "ShoppingCart")
+ .WithOne("Quote")
+ .HasForeignKey("LiteCharms.Features.Shop.Quotes.Entities.Quote", "ShoppingCartId");
+
+ b.Navigation("Customer");
+
+ b.Navigation("Order");
+
+ b.Navigation("ShoppingCart");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Customers.Entities.Customer", "Customer")
+ .WithMany("ShoppingCarts")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("LiteCharms.Features.Shop.Orders.Entities.Order", "Order")
+ .WithOne("ShoppingCart")
+ .HasForeignKey("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", "OrderId")
+ .OnDelete(DeleteBehavior.SetNull);
+
+ b.Navigation("Customer");
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCartItem", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.Products.Entities.ProductPrice", null)
+ .WithMany()
+ .HasForeignKey("ProductPriceId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("LiteCharms.Features.Shop.Products.Entities.ProductPrice", "ProductPrice")
+ .WithMany()
+ .HasForeignKey("ProductPriceId1");
+
+ b.HasOne("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", null)
+ .WithMany("ShoppingCartItems")
+ .HasForeignKey("ShoppingCartId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", "ShoppingCart")
+ .WithMany()
+ .HasForeignKey("ShoppingCartId1");
+
+ b.Navigation("ProductPrice");
+
+ b.Navigation("ShoppingCart");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCartPackage", b =>
+ {
+ b.HasOne("LiteCharms.Features.Shop.CartPackages.Entities.Package", "Package")
+ .WithMany()
+ .HasForeignKey("PackageId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", "ShoppingCart")
+ .WithMany("ShoppingCartPackages")
+ .HasForeignKey("ShoppingCartId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Package");
+
+ b.Navigation("ShoppingCart");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.CartPackages.Entities.Package", b =>
+ {
+ b.Navigation("PackageItems");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Customers.Entities.Customer", b =>
+ {
+ b.Navigation("Leads");
+
+ b.Navigation("Orders");
+
+ b.Navigation("Quotes");
+
+ b.Navigation("ShoppingCarts");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Orders.Entities.Order", b =>
+ {
+ b.Navigation("Quote");
+
+ b.Navigation("Refunds");
+
+ b.Navigation("ShoppingCart");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.Products.Entities.Product", b =>
+ {
+ b.Navigation("ProductPrices");
+ });
+
+ modelBuilder.Entity("LiteCharms.Features.Shop.ShoppingCarts.Entities.ShoppingCart", b =>
+ {
+ b.Navigation("Quote");
+
+ b.Navigation("ShoppingCartItems");
+
+ b.Navigation("ShoppingCartPackages");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs b/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs
new file mode 100644
index 0000000..234f04a
--- /dev/null
+++ b/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs
@@ -0,0 +1,936 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace LiteCharms.Features.Shop.Postgres.Migrations
+{
+ ///
+ public partial class UsedStringTableNames : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_PackageItem_ProductPrice_ProductPriceId",
+ table: "PackageItem");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_ShoppingCartItems_ProductPrice_ProductPriceId",
+ table: "ShoppingCartItems");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_ShoppingCartItems_ShoppingCart_ShoppingCartId",
+ table: "ShoppingCartItems");
+
+ migrationBuilder.DropTable(
+ name: "Lead");
+
+ migrationBuilder.DropTable(
+ name: "OrderRefund");
+
+ migrationBuilder.DropTable(
+ name: "ProductPrice");
+
+ migrationBuilder.DropTable(
+ name: "Quote");
+
+ migrationBuilder.DropTable(
+ name: "ShoppingCartPackage");
+
+ migrationBuilder.DropTable(
+ name: "Product");
+
+ migrationBuilder.DropTable(
+ name: "ShoppingCart");
+
+ migrationBuilder.DropTable(
+ name: "Order");
+
+ migrationBuilder.RenameColumn(
+ name: "Sender",
+ table: "Notification",
+ newName: "SenderAddress");
+
+ migrationBuilder.RenameColumn(
+ name: "Recipient",
+ table: "Notification",
+ newName: "RecipientName");
+
+ migrationBuilder.AlterColumn(
+ name: "UpdatedAt",
+ table: "ShoppingCartItems",
+ type: "timestamp with time zone",
+ nullable: true,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "timestamp with time zone");
+
+ migrationBuilder.AlterColumn(
+ name: "Quantity",
+ table: "ShoppingCartItems",
+ type: "integer",
+ nullable: false,
+ defaultValue: 1,
+ oldClrType: typeof(int),
+ oldType: "integer");
+
+ migrationBuilder.AlterColumn(
+ name: "CreatedAt",
+ table: "ShoppingCartItems",
+ type: "timestamp with time zone",
+ nullable: false,
+ defaultValueSql: "now()",
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "timestamp with time zone");
+
+ migrationBuilder.AddColumn(
+ name: "ProductPriceId1",
+ table: "ShoppingCartItems",
+ type: "uuid",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "ShoppingCartId1",
+ table: "ShoppingCartItems",
+ type: "uuid",
+ nullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "Name",
+ table: "Customer",
+ type: "text",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "text");
+
+ migrationBuilder.AlterColumn(
+ name: "LastName",
+ table: "Customer",
+ type: "text",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "text");
+
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "Customer",
+ type: "text",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "text");
+
+ migrationBuilder.AlterColumn(
+ name: "CreatedAt",
+ table: "Customer",
+ type: "timestamp with time zone",
+ nullable: false,
+ oldClrType: typeof(DateTimeOffset),
+ oldType: "timestamp with time zone",
+ oldDefaultValueSql: "now()");
+
+ migrationBuilder.AlterColumn(
+ name: "Active",
+ table: "Customer",
+ type: "boolean",
+ nullable: false,
+ oldClrType: typeof(bool),
+ oldType: "boolean",
+ oldDefaultValue: true);
+
+ migrationBuilder.CreateTable(
+ name: "Customers",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ Company = table.Column(type: "text", nullable: true),
+ Name = table.Column(type: "text", nullable: false),
+ LastName = table.Column(type: "text", nullable: false),
+ Tax = table.Column(type: "text", nullable: true),
+ Email = table.Column(type: "text", nullable: false),
+ Discord = table.Column(type: "text", nullable: true),
+ Slack = table.Column(type: "text", nullable: true),
+ LinkedIn = table.Column(type: "text", nullable: true),
+ Whatsapp = table.Column(type: "text", nullable: true),
+ Website = table.Column(type: "text", nullable: true),
+ Phone = table.Column(type: "text", nullable: true),
+ Address = table.Column(type: "text", nullable: true),
+ City = table.Column(type: "text", nullable: true),
+ Region = table.Column(type: "text", nullable: true),
+ Country = table.Column(type: "text", nullable: true),
+ PostalCode = table.Column(type: "text", nullable: true),
+ Active = table.Column(type: "boolean", nullable: false, defaultValue: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Customers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Products",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ Name = table.Column(type: "text", nullable: false),
+ Summary = table.Column(type: "character varying(512)", maxLength: 512, nullable: false),
+ Description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: false),
+ ImageUrl = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true),
+ Thumbnails = table.Column(type: "jsonb", nullable: true),
+ Active = table.Column(type: "boolean", nullable: false, defaultValue: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Products", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Leads",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CustomerId1 = table.Column(type: "uuid", nullable: true),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ CustomerId = table.Column(type: "uuid", nullable: true),
+ Source = table.Column(type: "text", nullable: true),
+ ClickId = table.Column(type: "text", nullable: true),
+ WebClickId = table.Column(type: "text", nullable: true),
+ AppClickId = table.Column(type: "text", nullable: true),
+ CampaignId = table.Column(type: "bigint", nullable: true),
+ AdGroupId = table.Column(type: "bigint", nullable: true),
+ AdName = table.Column(type: "bigint", nullable: true),
+ TargetId = table.Column(type: "bigint", nullable: true),
+ FeedItemId = table.Column(type: "bigint", nullable: true),
+ ClickLocation = table.Column(type: "text", nullable: true),
+ AttributionHash = table.Column(type: "text", nullable: false),
+ Status = table.Column(type: "integer", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Leads", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Leads_Customer_CustomerId",
+ column: x => x.CustomerId,
+ principalTable: "Customer",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ table.ForeignKey(
+ name: "FK_Leads_Customers_CustomerId1",
+ column: x => x.CustomerId1,
+ principalTable: "Customers",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Orders",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ CustomerId = table.Column(type: "uuid", nullable: false),
+ Status = table.Column(type: "integer", nullable: false),
+ Requirements = table.Column(type: "jsonb", nullable: true),
+ Notes = table.Column(type: "jsonb", nullable: true),
+ Terms = table.Column(type: "jsonb", nullable: true),
+ InvoiceUrl = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Orders", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Orders_Customers_CustomerId",
+ column: x => x.CustomerId,
+ principalTable: "Customers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ProductPrices",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ ProductId = table.Column(type: "uuid", nullable: false),
+ Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false),
+ Discount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false),
+ Active = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ProductPrices", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ProductPrices_Products_ProductId",
+ column: x => x.ProductId,
+ principalTable: "Products",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "OrderRefunds",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ OrderId = table.Column(type: "uuid", nullable: false),
+ Reason = table.Column(type: "text", nullable: false),
+ Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_OrderRefunds", x => x.Id);
+ table.ForeignKey(
+ name: "FK_OrderRefunds_Orders_OrderId",
+ column: x => x.OrderId,
+ principalTable: "Orders",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ShoppingCarts",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ CustomerId = table.Column(type: "uuid", nullable: false),
+ OrderId = table.Column(type: "uuid", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ShoppingCarts", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ShoppingCarts_Customers_CustomerId",
+ column: x => x.CustomerId,
+ principalTable: "Customers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_ShoppingCarts_Orders_OrderId",
+ column: x => x.OrderId,
+ principalTable: "Orders",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.SetNull);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Quotes",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
+ ExpiredAt = table.Column(type: "timestamp with time zone", nullable: true),
+ CustomerId = table.Column(type: "uuid", nullable: false),
+ OrderId = table.Column(type: "uuid", nullable: true),
+ ShoppingCartId = table.Column(type: "uuid", nullable: true),
+ Status = table.Column(type: "integer", nullable: false),
+ InvoiceUrl = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true),
+ Reason = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Quotes", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Quotes_Customers_CustomerId",
+ column: x => x.CustomerId,
+ principalTable: "Customers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Quotes_Orders_OrderId",
+ column: x => x.OrderId,
+ principalTable: "Orders",
+ principalColumn: "Id");
+ table.ForeignKey(
+ name: "FK_Quotes_ShoppingCarts_ShoppingCartId",
+ column: x => x.ShoppingCartId,
+ principalTable: "ShoppingCarts",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ShoppingCartPackages",
+ columns: table => new
+ {
+ Id = table.Column(type: "uuid", nullable: false),
+ CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
+ ShoppingCartId = table.Column