//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ServiceStationsDataBaseImplement;
#nullable disable
namespace ServiceStationsDataBaseImplement.Migrations
{
[DbContext(typeof(Database))]
[Migration("20240820063305_InitMigration")]
partial class InitMigration
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.18")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Client", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Executor", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Executors");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.TaskByWork", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Tasks");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Work", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Date")
.HasColumnType("datetime2");
b.Property("ExecutorId")
.HasColumnType("int");
b.Property("Price")
.HasColumnType("float");
b.Property("TaskId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecutorId");
b.ToTable("Works");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.WorkClient", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("int");
b.Property("PointCount")
.HasColumnType("int");
b.Property("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("WorkId");
b.ToTable("WorksClients");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Work", b =>
{
b.HasOne("ServiceStationsDataBaseImplement.Models.Executor", null)
.WithMany("Works")
.HasForeignKey("ExecutorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.WorkClient", b =>
{
b.HasOne("ServiceStationsDataBaseImplement.Models.Client", "_client")
.WithMany("WorkClients")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ServiceStationsDataBaseImplement.Models.Work", "_work")
.WithMany("WorkClients")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("_client");
b.Navigation("_work");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Client", b =>
{
b.Navigation("WorkClients");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Executor", b =>
{
b.Navigation("Works");
});
modelBuilder.Entity("ServiceStationsDataBaseImplement.Models.Work", b =>
{
b.Navigation("WorkClients");
});
#pragma warning restore 612, 618
}
}
}