//
using System;
using Distribution.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Distribution.Migrations
{
[DbContext(typeof(AppDBContext))]
[Migration("20260818065939_initialDbCreate")]
partial class initialDbCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Distribution.Models.DeliveryRun", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("FK_RouteId")
.HasColumnType("char(36)");
b.Property("FK_VehicleId")
.HasColumnType("char(36)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("Meterend")
.HasColumnType("int");
b.Property("Meterstart")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("FK_RouteId");
b.HasIndex("FK_VehicleId");
b.ToTable("DeliveryRuns");
});
modelBuilder.Entity("Distribution.Models.Item", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.ToTable("Items");
});
modelBuilder.Entity("Distribution.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("FK_StoreId")
.HasColumnType("char(36)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("OrderDate")
.HasColumnType("datetime(6)");
b.Property("TotalAmount")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("FK_StoreId");
b.ToTable("Orders");
});
modelBuilder.Entity("Distribution.Models.OrderItem", b =>
{
b.Property("FK_OrderId")
.HasColumnType("char(36)");
b.Property("FK_ItemId")
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Id")
.HasColumnType("char(36)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("Quantity")
.HasColumnType("int");
b.HasKey("FK_OrderId", "FK_ItemId");
b.HasIndex("FK_ItemId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Distribution.Models.Region", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("Regions");
});
modelBuilder.Entity("Distribution.Models.Route", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("EndPoint")
.IsRequired()
.HasColumnType("longtext");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("Length")
.HasColumnType("decimal(18,2)");
b.Property("RouteName")
.IsRequired()
.HasColumnType("longtext");
b.Property("StartPoint")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("Routes");
});
modelBuilder.Entity("Distribution.Models.SaleRoute", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.ToTable("SaleRoutes");
});
modelBuilder.Entity("Distribution.Models.Store", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("CreditAmount")
.HasColumnType("decimal(18,2)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("Latitude")
.HasColumnType("decimal(18,2)");
b.Property("Longitude")
.HasColumnType("decimal(18,2)");
b.Property("OneTimeAmount")
.HasColumnType("decimal(18,2)");
b.Property("OwnerName")
.IsRequired()
.HasColumnType("longtext");
b.Property("StoreAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property("StoreName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("Stores");
});
modelBuilder.Entity("Distribution.Models.Vehicle", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("NumberPlate")
.IsRequired()
.HasColumnType("longtext");
b.Property("RegNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property("Type")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Vehicles");
});
modelBuilder.Entity("Distribution.Models.Warehouse", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("Location")
.IsRequired()
.HasColumnType("longtext");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("Type")
.HasColumnType("int");
b.Property("VehicleId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("VehicleId");
b.ToTable("Warehouses");
});
modelBuilder.Entity("Distribution.Models.DeliveryRun", b =>
{
b.HasOne("Distribution.Models.Route", "Route")
.WithMany()
.HasForeignKey("FK_RouteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Distribution.Models.Vehicle", "Vehicle")
.WithMany()
.HasForeignKey("FK_VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Route");
b.Navigation("Vehicle");
});
modelBuilder.Entity("Distribution.Models.Order", b =>
{
b.HasOne("Distribution.Models.Store", "Store")
.WithMany()
.HasForeignKey("FK_StoreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Store");
});
modelBuilder.Entity("Distribution.Models.OrderItem", b =>
{
b.HasOne("Distribution.Models.Item", "Item")
.WithMany()
.HasForeignKey("FK_ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Distribution.Models.Order", "Order")
.WithMany()
.HasForeignKey("FK_OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Item");
b.Navigation("Order");
});
modelBuilder.Entity("Distribution.Models.Warehouse", b =>
{
b.HasOne("Distribution.Models.Vehicle", "Vehicle")
.WithMany()
.HasForeignKey("VehicleId");
b.Navigation("Vehicle");
});
#pragma warning restore 612, 618
}
}
}