//
using System;
using CarServiceDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CarServiceDatabase.Migrations
{
[DbContext(typeof(CarServiceDbContext))]
[Migration("20230404184042_InitMigration")]
partial class InitMigration
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Surname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Count")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Price")
.HasColumnType("decimal (10,2)");
b.Property("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Items");
});
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Count")
.HasColumnType("int");
b.Property("ItemId")
.HasColumnType("int");
b.Property("RepairRequestId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ItemId");
b.HasIndex("RepairRequestId");
b.ToTable("ItemsForRepair");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("DateCreated")
.HasColumnType("datetime2");
b.Property("VehicleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VehicleId");
b.ToTable("RepairRequests");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CustomerId")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Plate")
.HasColumnType("nvarchar(max)");
b.Property("VIN")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Vehicles");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Duration")
.HasColumnType("decimal (3,1)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Price")
.HasColumnType("decimal (10,2)");
b.Property("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Works");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Cost")
.HasColumnType("decimal (10,2)");
b.Property("Count")
.HasColumnType("int");
b.Property("RepairRequestId")
.HasColumnType("int");
b.Property("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RepairRequestId");
b.HasIndex("WorkId");
b.ToTable("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("DatePayment")
.HasColumnType("datetime2");
b.Property("Sum")
.HasColumnType("decimal (10,2)");
b.Property("WorkInRequestId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkInRequestId");
b.ToTable("WorkPayments");
});
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Surname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.HasOne("CarServiceDatabase.Models.Worker", "Worker")
.WithMany("Items")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
{
b.HasOne("CarServiceDatabase.Models.Item", "Item")
.WithMany("ItemsForRepair")
.HasForeignKey("ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CarServiceDatabase.Models.RepairRequest", "RepairRequest")
.WithMany("ItemsForRepair")
.HasForeignKey("RepairRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Item");
b.Navigation("RepairRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.HasOne("CarServiceDatabase.Models.Vehicle", "Vehicle")
.WithMany("RepairRequests")
.HasForeignKey("VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Vehicle");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.HasOne("CarServiceDatabase.Models.Customer", "Customer")
.WithMany("Vehicles")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Customer");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.HasOne("CarServiceDatabase.Models.Worker", "Worker")
.WithMany("Works")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.HasOne("CarServiceDatabase.Models.RepairRequest", "RepairRequest")
.WithMany("WorksInRequest")
.HasForeignKey("RepairRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CarServiceDatabase.Models.Work", "Work")
.WithMany("WorksInRequest")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RepairRequest");
b.Navigation("Work");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
{
b.HasOne("CarServiceDatabase.Models.WorkInRequest", "WorkInRequest")
.WithMany("WorkPayments")
.HasForeignKey("WorkInRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WorkInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
{
b.Navigation("Vehicles");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.Navigation("ItemsForRepair");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.Navigation("ItemsForRepair");
b.Navigation("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.Navigation("RepairRequests");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.Navigation("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.Navigation("WorkPayments");
});
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
{
b.Navigation("Items");
b.Navigation("Works");
});
#pragma warning restore 612, 618
}
}
}