//
using System;
using LogisticsApp.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LogisticsApp.Server.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251128103633_fix")]
partial class fix
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LogisticsApp.Server.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Address")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property("ClientName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("OrderCost")
.HasColumnType("decimal(18,2)");
b.Property("OrderDate")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ClientName");
b.HasIndex("OrderDate");
b.HasIndex("Status");
b.ToTable("Orders");
});
modelBuilder.Entity("LogisticsApp.Server.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("Role")
.IsRequired()
.HasColumnType("text");
b.Property("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("LogisticsApp.Server.Models.Vehicle", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DriverName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("LicensePlate")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("VehicleType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("LicensePlate");
b.ToTable("Vehicles");
});
modelBuilder.Entity("LogisticsApp.Server.Models.WaybillEntry", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Date")
.HasColumnType("date");
b.Property("EndTime")
.IsRequired()
.HasMaxLength(5)
.HasColumnType("character varying(5)");
b.Property("OrderId")
.HasColumnType("integer");
b.Property("StartTime")
.IsRequired()
.HasMaxLength(5)
.HasColumnType("character varying(5)");
b.Property("VehicleId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("VehicleId", "Date");
b.ToTable("WaybillEntries");
});
modelBuilder.Entity("LogisticsApp.Server.Models.WaybillEntry", b =>
{
b.HasOne("LogisticsApp.Server.Models.Order", "Order")
.WithMany()
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LogisticsApp.Server.Models.Vehicle", "Vehicle")
.WithMany()
.HasForeignKey("VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Vehicle");
});
#pragma warning restore 612, 618
}
}
}