// using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using SmallSoftwareDatabase; #nullable disable namespace SmallSoftwareDatabase.Migrations { [DbContext(typeof(SmallSoftwareDbContext))] [Migration("20250417140247_FirstMigration")] partial class FirstMigration { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "9.0.2") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("SmallSoftwareDatabase.Models.InstallationRequest", b => { b.Property("RequestId") .HasColumnType("text"); b.Property("SoftwareId") .HasColumnType("text"); b.Property("Count") .HasColumnType("integer"); b.Property("Price") .HasColumnType("double precision"); b.HasKey("RequestId", "SoftwareId"); b.HasIndex("SoftwareId"); b.ToTable("InstallationRequests"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Manufacturer", b => { b.Property("Id") .HasColumnType("text"); b.Property("ManufacturerName") .IsRequired() .HasColumnType("text"); b.Property("PrevManufacturerName") .HasColumnType("text"); b.Property("PrevPrevManufacturerName") .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("ManufacturerName") .IsUnique(); b.ToTable("Manufacturers"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Post", b => { b.Property("Id") .HasColumnType("text"); b.Property("ChangeDate") .HasColumnType("timestamp without time zone"); b.Property("IsActual") .HasColumnType("boolean"); b.Property("PostId") .IsRequired() .HasColumnType("text"); b.Property("PostName") .IsRequired() .HasColumnType("text"); b.Property("PostType") .HasColumnType("integer"); b.Property("Salary") .HasColumnType("double precision"); b.HasKey("Id"); b.HasIndex("PostId", "IsActual") .IsUnique() .HasFilter("\"IsActual\" = TRUE"); b.HasIndex("PostName", "IsActual") .IsUnique() .HasFilter("\"IsActual\" = TRUE"); b.ToTable("Posts"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b => { b.Property("Id") .HasColumnType("text"); b.Property("Email") .IsRequired() .HasColumnType("text"); b.Property("IsCancel") .HasColumnType("boolean"); b.Property("RequestDate") .HasColumnType("timestamp without time zone"); b.Property("Sum") .HasColumnType("double precision"); b.Property("WorkerId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("WorkerId"); b.ToTable("Requests"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Salary", b => { b.Property("Id") .HasColumnType("text"); b.Property("SalaryDate") .HasColumnType("timestamp without time zone"); b.Property("WorkerId") .IsRequired() .HasColumnType("text"); b.Property("WorkerSalary") .HasColumnType("double precision"); b.HasKey("Id"); b.HasIndex("WorkerId"); b.ToTable("Salaries"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b => { b.Property("Id") .HasColumnType("text"); b.Property("IsDeleted") .HasColumnType("boolean"); b.Property("ManufacturerId") .IsRequired() .HasColumnType("text"); b.Property("PrevPrevSoftwareName") .HasColumnType("text"); b.Property("PrevSoftwareName") .HasColumnType("text"); b.Property("Price") .HasColumnType("double precision"); b.Property("SoftwareName") .IsRequired() .HasColumnType("text"); b.Property("SoftwareType") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("ManufacturerId"); b.HasIndex("SoftwareName", "IsDeleted") .IsUnique() .HasFilter("\"IsDeleted\" = FALSE"); b.ToTable("Softwares"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.SoftwareHistory", b => { b.Property("Id") .HasColumnType("text"); b.Property("ChangeDate") .HasColumnType("timestamp without time zone"); b.Property("OldPrice") .HasColumnType("double precision"); b.Property("SoftwareId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("SoftwareId"); b.ToTable("SoftwareHistories"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Worker", b => { b.Property("Id") .HasColumnType("text"); b.Property("BirthDate") .HasColumnType("timestamp without time zone"); b.Property("EmploymentDate") .HasColumnType("timestamp without time zone"); b.Property("FIO") .IsRequired() .HasColumnType("text"); b.Property("IsDeleted") .HasColumnType("boolean"); b.Property("PostId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("Workers"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.InstallationRequest", b => { b.HasOne("SmallSoftwareDatabase.Models.Request", "Request") .WithMany("InstallationRequests") .HasForeignKey("RequestId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("SmallSoftwareDatabase.Models.Software", "Software") .WithMany("InstallationRequests") .HasForeignKey("SoftwareId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Request"); b.Navigation("Software"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b => { b.HasOne("SmallSoftwareDatabase.Models.Worker", "Worker") .WithMany("Requests") .HasForeignKey("WorkerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Worker"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Salary", b => { b.HasOne("SmallSoftwareDatabase.Models.Worker", "Worker") .WithMany("Salaries") .HasForeignKey("WorkerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Worker"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b => { b.HasOne("SmallSoftwareDatabase.Models.Manufacturer", "Manufacturer") .WithMany("Softwares") .HasForeignKey("ManufacturerId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Manufacturer"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.SoftwareHistory", b => { b.HasOne("SmallSoftwareDatabase.Models.Software", "Software") .WithMany("SoftwareHistories") .HasForeignKey("SoftwareId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Software"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Manufacturer", b => { b.Navigation("Softwares"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b => { b.Navigation("InstallationRequests"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b => { b.Navigation("InstallationRequests"); b.Navigation("SoftwareHistories"); }); modelBuilder.Entity("SmallSoftwareDatabase.Models.Worker", b => { b.Navigation("Requests"); b.Navigation("Salaries"); }); #pragma warning restore 612, 618 } } }