// using System; using CarShowroomDatabaseStorage; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace CarShowroomDatabaseStorage.Migrations { [DbContext(typeof(CarShowroomDatabase))] [Migration("20240512174258_changeCarsAndSale")] partial class changeCarsAndSale { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "7.0.18") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Car", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("car_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Color") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(50) .HasColumnType("character varying(50)") .HasDefaultValue("empty_string") .HasColumnName("car_color"); b.Property("IsSaled") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("car_issaled"); b.Property("ModelId") .HasColumnType("integer") .HasColumnName("car_model_id"); b.Property("ReleaseDate") .HasColumnType("timestamp with time zone") .HasColumnName("car_releasedate"); b.HasKey("Id"); b.HasIndex("ModelId"); b.ToTable("car"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Client", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("client_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(50) .HasColumnType("character varying(50)") .HasDefaultValue("empty_string") .HasColumnName("client_name"); b.Property("PhoneNumber") .IsRequired() .HasMaxLength(25) .HasColumnType("character varying(25)") .HasColumnName("client_phonenumber"); b.HasKey("Id"); b.HasIndex("PhoneNumber") .IsUnique(); b.ToTable("client"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Employee", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("employee_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Email") .IsRequired() .HasMaxLength(40) .HasColumnType("character varying(40)") .HasColumnName("employee_email"); b.Property("Name") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(50) .HasColumnType("character varying(50)") .HasDefaultValue("empty_string") .HasColumnName("employee_name"); b.Property("Password") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(32) .HasColumnType("character varying(32)") .HasDefaultValue("empty_string") .HasColumnName("employee_password"); b.HasKey("Id"); b.HasIndex("Email") .IsUnique(); b.ToTable("employee"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Make", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("make_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)") .HasColumnName("make_name"); b.HasKey("Id"); b.HasIndex("Name") .IsUnique(); b.ToTable("make"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Model", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("model_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("MakeId") .HasColumnType("integer") .HasColumnName("model_make_id"); b.Property("Name") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)") .HasColumnName("model_name"); b.Property("Price") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(-1) .HasColumnName("model_price"); b.HasKey("Id"); b.HasIndex("MakeId"); b.HasIndex("Name") .IsUnique(); b.ToTable("model"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Sale", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("sale_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ClientId") .HasColumnType("integer") .HasColumnName("sale_client_id"); b.Property("Cost") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(-1) .HasColumnName("sale_cost"); b.Property("EmployeeId") .HasColumnType("integer") .HasColumnName("sale_employee_id"); b.Property("SaleTime") .HasColumnType("timestamp with time zone") .HasColumnName("sale_time"); b.HasKey("Id"); b.HasIndex("ClientId"); b.HasIndex("EmployeeId"); b.ToTable("sale"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.SaleCar", b => { b.Property("SaleId") .HasColumnType("integer") .HasColumnName("sale_id"); b.Property("CarId") .HasColumnType("integer") .HasColumnName("car_id"); b.HasKey("SaleId", "CarId"); b.HasIndex("CarId"); b.ToTable("sale_car"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.SaleService", b => { b.Property("SaleId") .HasColumnType("integer") .HasColumnName("sale_id"); b.Property("ServiceId") .HasColumnType("integer") .HasColumnName("service_id"); b.HasKey("SaleId", "ServiceId"); b.HasIndex("ServiceId"); b.ToTable("sale_service"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Service", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("service_id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Cost") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(-1) .HasColumnName("service_cost"); b.Property("Name") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)") .HasColumnName("service_name"); b.HasKey("Id"); b.HasIndex("Name") .IsUnique(); b.ToTable("service"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Car", b => { b.HasOne("CarShowroomDatabaseStorage.Entities.Model", "Model") .WithMany("Cars") .HasForeignKey("ModelId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Model"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Model", b => { b.HasOne("CarShowroomDatabaseStorage.Entities.Make", "Make") .WithMany("Models") .HasForeignKey("MakeId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Make"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Sale", b => { b.HasOne("CarShowroomDatabaseStorage.Entities.Client", "Client") .WithMany("Sales") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.SetNull); b.HasOne("CarShowroomDatabaseStorage.Entities.Employee", "Employee") .WithMany("Sales") .HasForeignKey("EmployeeId") .OnDelete(DeleteBehavior.SetNull); b.Navigation("Client"); b.Navigation("Employee"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.SaleCar", b => { b.HasOne("CarShowroomDatabaseStorage.Entities.Car", "Car") .WithMany("SaleCars") .HasForeignKey("CarId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CarShowroomDatabaseStorage.Entities.Sale", "Sale") .WithMany("SaleCars") .HasForeignKey("SaleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Car"); b.Navigation("Sale"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.SaleService", b => { b.HasOne("CarShowroomDatabaseStorage.Entities.Sale", "Sale") .WithMany("SaleServices") .HasForeignKey("SaleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CarShowroomDatabaseStorage.Entities.Service", "Service") .WithMany("SaleServices") .HasForeignKey("ServiceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Sale"); b.Navigation("Service"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Car", b => { b.Navigation("SaleCars"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Client", b => { b.Navigation("Sales"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Employee", b => { b.Navigation("Sales"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Make", b => { b.Navigation("Models"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Model", b => { b.Navigation("Cars"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Sale", b => { b.Navigation("SaleCars"); b.Navigation("SaleServices"); }); modelBuilder.Entity("CarShowroomDatabaseStorage.Entities.Service", b => { b.Navigation("SaleServices"); }); #pragma warning restore 612, 618 } } }