410 lines
15 KiB
C#
410 lines
15 KiB
C#
// <auto-generated />
|
|
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
|
|
{
|
|
/// <inheritdoc />
|
|
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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("car_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Color")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)")
|
|
.HasDefaultValue("empty_string")
|
|
.HasColumnName("car_color");
|
|
|
|
b.Property<bool>("IsSaled")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("boolean")
|
|
.HasDefaultValue(false)
|
|
.HasColumnName("car_issaled");
|
|
|
|
b.Property<int>("ModelId")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("car_model_id");
|
|
|
|
b.Property<DateTime>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("client_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)")
|
|
.HasDefaultValue("empty_string")
|
|
.HasColumnName("client_name");
|
|
|
|
b.Property<string>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("employee_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Email")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("character varying(40)")
|
|
.HasColumnName("employee_email");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)")
|
|
.HasDefaultValue("empty_string")
|
|
.HasColumnName("employee_name");
|
|
|
|
b.Property<string>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("make_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("model_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("MakeId")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("model_make_id");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)")
|
|
.HasColumnName("model_name");
|
|
|
|
b.Property<int>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("sale_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int?>("ClientId")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("sale_client_id");
|
|
|
|
b.Property<int>("Cost")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(-1)
|
|
.HasColumnName("sale_cost");
|
|
|
|
b.Property<int?>("EmployeeId")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("sale_employee_id");
|
|
|
|
b.Property<DateTime>("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<int>("SaleId")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("sale_id");
|
|
|
|
b.Property<int>("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<int>("SaleId")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("sale_id");
|
|
|
|
b.Property<int>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("service_id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("Cost")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(-1)
|
|
.HasColumnName("service_cost");
|
|
|
|
b.Property<string>("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
|
|
}
|
|
}
|
|
}
|