//
using System;
using AutoubsApi.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NetTopologySuite.Geometries;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AutobusApi.Infrastructure.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20231113193110_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("domain")
.HasAnnotation("ProductVersion", "7.0.13")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("AutobusApi.Domain.Entities.Address", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CityId")
.HasColumnType("int")
.HasColumnName("city_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Location")
.IsRequired()
.HasColumnType("geography(point)")
.HasColumnName("location");
b.Property("Name")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("name");
b.Property("VehicleType")
.IsRequired()
.HasColumnType("varchar(16)")
.HasColumnName("vehicle_type");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("addresses", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Carriage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Capacity")
.HasColumnType("int")
.HasColumnName("capacity");
b.Property("HasOutlets")
.HasColumnType("boolean")
.HasColumnName("has_outlets");
b.Property("HasWiFi")
.HasColumnType("boolean")
.HasColumnName("has_wifi");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Number")
.HasColumnType("int")
.HasColumnName("number");
b.Property("Type")
.IsRequired()
.HasColumnType("varchar(16)")
.HasColumnName("type");
b.HasKey("Id");
b.ToTable("carriages", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.City", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Name")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("name");
b.Property("RegionId")
.HasColumnType("int")
.HasColumnName("region_id");
b.HasKey("Id");
b.HasIndex("RegionId");
b.ToTable("cities", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Company", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ContactEmail")
.IsRequired()
.HasColumnType("varchar(256)")
.HasColumnName("contact_email");
b.Property("ContactPhoneNumber")
.IsRequired()
.HasColumnType("varchar(16)")
.HasColumnName("contact_phone_number");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("LegalAddress")
.IsRequired()
.HasColumnType("varchar(256)")
.HasColumnName("legal_address");
b.Property("Name")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("name");
b.HasKey("Id");
b.ToTable("companies", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Country", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Name")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("name");
b.HasKey("Id");
b.ToTable("countries", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Employee", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BirthDate")
.HasColumnType("date")
.HasColumnName("birth_date");
b.Property("EmployerCompanyId")
.HasColumnType("int")
.HasColumnName("employer_company_id");
b.Property("FisrtName")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("first_name");
b.Property("IdentityId")
.HasColumnType("int")
.HasColumnName("identity_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("LastName")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("last_name");
b.Property("Patronymic")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("patronymic");
b.Property("Sex")
.IsRequired()
.HasColumnType("varchar(16)")
.HasColumnName("sex");
b.HasKey("Id");
b.HasIndex("EmployerCompanyId");
b.HasIndex("IdentityId")
.IsUnique();
b.ToTable("employees", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.EmployeeDocument", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("EmployeeId")
.HasColumnType("int")
.HasColumnName("employee_id");
b.Property("Information")
.IsRequired()
.HasColumnType("varchar(256)")
.HasColumnName("information");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Type")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("type");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.ToTable("employee_documents", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Region", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CountryId")
.HasColumnType("int")
.HasColumnName("country_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Name")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("name");
b.HasKey("Id");
b.HasIndex("CountryId");
b.ToTable("regions", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Review", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("varchar(128)")
.HasColumnName("comment");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("PostDateTimeUtc")
.HasColumnType("timestamptz")
.HasColumnName("post_timestamp_utc");
b.Property("Rating")
.HasColumnType("numeric(1,0)")
.HasColumnName("rating");
b.Property("UserId")
.HasColumnType("int")
.HasColumnName("user_id");
b.Property("VehicleEnrollmentId")
.HasColumnType("int")
.HasColumnName("vehicle_enrollment_id");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("VehicleEnrollmentId");
b.ToTable("reviews", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Route", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.HasKey("Id");
b.ToTable("routes", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.RouteAddress", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AddressId")
.HasColumnType("int")
.HasColumnName("address_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("Order")
.HasColumnType("int")
.HasColumnName("order");
b.Property("RouteId")
.HasColumnType("int")
.HasColumnName("route_id");
b.HasKey("Id");
b.HasIndex("AddressId");
b.HasIndex("RouteId");
b.ToTable("route_addresses", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.RouteAddressDetails", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CostToNextAddress")
.HasColumnType("numeric(16,4)")
.HasColumnName("cost_to_next_address");
b.Property("CurrentAddressStopTime")
.HasColumnType("interval")
.HasColumnName("current_address_stop_time");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("RouteAddressId")
.HasColumnType("int")
.HasColumnName("route_address_id");
b.Property("TimeToNextAddress")
.HasColumnType("interval")
.HasColumnName("time_to_next_address");
b.Property("VehicleEnrollmentId")
.HasColumnType("int")
.HasColumnName("vehicle_enrollment_id");
b.HasKey("Id");
b.HasIndex("RouteAddressId");
b.HasIndex("VehicleEnrollmentId");
b.ToTable("route_address_details", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Ticket", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("TicketGroupId")
.HasColumnType("int")
.HasColumnName("ticket_group_id");
b.Property("VehicleEnrollmentId")
.HasColumnType("int")
.HasColumnName("vehicle_enrollment_id");
b.HasKey("Id");
b.HasIndex("TicketGroupId");
b.HasIndex("VehicleEnrollmentId");
b.ToTable("tickets", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TicketDocument", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Information")
.IsRequired()
.HasColumnType("varchar(256)")
.HasColumnName("information");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("TicketGroupId")
.HasColumnType("int")
.HasColumnName("ticket_group_id");
b.Property("Type")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("type");
b.HasKey("Id");
b.ToTable("ticket_documents", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TicketGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BuyerEmailAddress")
.IsRequired()
.HasColumnType("varchar(256)")
.HasColumnName("buyer_email");
b.Property("BuyerFirstName")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("buyer_first_name");
b.Property("BuyerLastName")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("buyer_last_name");
b.Property("BuyerPhoneNumber")
.IsRequired()
.HasColumnType("varchar(16)")
.HasColumnName("buyer_phone_number");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("IsReturned")
.HasColumnType("boolean")
.HasColumnName("is_returned");
b.Property("PassengerBirthDate")
.HasColumnType("date")
.HasColumnName("passenger_birth_date");
b.Property("PassengerFirstName")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("passenger_first_name");
b.Property("PassengerLastName")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("passenger_last_name");
b.Property("PassengerPatronymic")
.IsRequired()
.HasColumnType("varchar(32)")
.HasColumnName("passenger_patronymic");
b.Property("PassengerSex")
.IsRequired()
.HasColumnType("varchar(16)")
.HasColumnName("passenger_sex");
b.Property("PurchaseDateTimeUtc")
.HasColumnType("timestamptz")
.HasColumnName("purchase_timestamp_utc");
b.Property("TicketDocumentId")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("int")
.HasColumnName("user_id");
b.HasKey("Id");
b.HasIndex("TicketDocumentId")
.IsUnique();
b.HasIndex("UserId");
b.ToTable("ticket_groups", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TrainCarriage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CarriageId")
.HasColumnType("int")
.HasColumnName("carriage_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("TrainId")
.HasColumnType("int")
.HasColumnName("train_id");
b.HasKey("Id");
b.HasIndex("TrainId");
b.ToTable("train_carriages", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("IdentityId")
.HasColumnType("int")
.HasColumnName("identity_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.HasKey("Id");
b.HasIndex("IdentityId")
.IsUnique();
b.ToTable("users", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Vehicle", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CompanyId")
.HasColumnType("int")
.HasColumnName("company_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.HasKey("Id");
b.HasIndex("CompanyId");
b.ToTable("vehicles", "domain");
b.UseTptMappingStrategy();
});
modelBuilder.Entity("AutobusApi.Domain.Entities.VehicleEnrollment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DepartureDateTimeUtc")
.HasColumnType("timestamptz")
.HasColumnName("departure_timestamp_utc");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("RouteId")
.HasColumnType("int")
.HasColumnName("route_id");
b.Property("VehicleId")
.HasColumnType("int")
.HasColumnName("vehicle_id");
b.HasKey("Id");
b.HasIndex("RouteId");
b.HasIndex("VehicleId");
b.ToTable("vehicle_enrollments", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.VehicleEnrollmentEmployee", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("EmployeeId")
.HasColumnType("int")
.HasColumnName("employee_id");
b.Property("IsDeleted")
.HasColumnType("boolean")
.HasColumnName("is_deleted");
b.Property("VehicleEnrollmentId")
.HasColumnType("int")
.HasColumnName("vehicle_enrollment_id");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("VehicleEnrollmentId");
b.ToTable("vehicle_enrollment_employees", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Aircraft", b =>
{
b.HasBaseType("AutobusApi.Domain.Entities.Vehicle");
b.Property("Capacity")
.HasColumnType("int")
.HasColumnName("capacity");
b.Property("HasMultimedia")
.HasColumnType("boolean")
.HasColumnName("has_multimedia");
b.Property("HasWiFi")
.HasColumnType("boolean")
.HasColumnName("has_wifi");
b.Property("Model")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("model");
b.Property("Number")
.IsRequired()
.HasColumnType("varchar(8)")
.HasColumnName("number");
b.ToTable("aircrafts", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Bus", b =>
{
b.HasBaseType("AutobusApi.Domain.Entities.Vehicle");
b.Property("Capacity")
.HasColumnType("int")
.HasColumnName("capacity");
b.Property("HasClimateControl")
.HasColumnType("boolean")
.HasColumnName("has_climate_control");
b.Property("HasMultimedia")
.HasColumnType("boolean")
.HasColumnName("has_multimedia");
b.Property("HasOutlets")
.HasColumnType("boolean")
.HasColumnName("has_outlets");
b.Property("HasWC")
.HasColumnType("boolean")
.HasColumnName("has_wc");
b.Property("HasWiFi")
.HasColumnType("boolean")
.HasColumnName("has_wifi");
b.Property("Model")
.IsRequired()
.HasColumnType("varchar(64)")
.HasColumnName("model");
b.Property("Number")
.IsRequired()
.HasColumnType("varchar(8)")
.HasColumnName("number");
b.ToTable("buses", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Train", b =>
{
b.HasBaseType("AutobusApi.Domain.Entities.Vehicle");
b.Property("Number")
.IsRequired()
.HasColumnType("varchar(8)")
.HasColumnName("number");
b.ToTable("trains", "domain");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Address", b =>
{
b.HasOne("AutobusApi.Domain.Entities.City", "City")
.WithMany("Addresses")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_addresses_city_id");
b.Navigation("City");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.City", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Region", "Region")
.WithMany("Cities")
.HasForeignKey("RegionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_cities_regions_regionId");
b.Navigation("Region");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Employee", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Company", "EmployerCompany")
.WithMany("Employees")
.HasForeignKey("EmployerCompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_employees_companies_employerCompanyId");
b.Navigation("EmployerCompany");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.EmployeeDocument", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Employee", "Employee")
.WithMany("Documents")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_employeeDocuments_employees_employeeId");
b.Navigation("Employee");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Region", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Country", "Country")
.WithMany("Regions")
.HasForeignKey("CountryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_regions_coutries_countryId");
b.Navigation("Country");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Review", b =>
{
b.HasOne("AutobusApi.Domain.Entities.User", "User")
.WithMany("Reviews")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_reviews_users_userId");
b.HasOne("AutobusApi.Domain.Entities.VehicleEnrollment", "VehicleEnrollment")
.WithMany("Reviews")
.HasForeignKey("VehicleEnrollmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_reviews_vehicleEnrollments_vehicleEnrollmentId");
b.Navigation("User");
b.Navigation("VehicleEnrollment");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.RouteAddress", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Address", "Address")
.WithMany("RouteAddresses")
.HasForeignKey("AddressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_routeAddresses_addresses_addressId");
b.HasOne("AutobusApi.Domain.Entities.Route", "Route")
.WithMany("RouteAddresses")
.HasForeignKey("RouteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_routeAddresses_routes_routeId");
b.Navigation("Address");
b.Navigation("Route");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.RouteAddressDetails", b =>
{
b.HasOne("AutobusApi.Domain.Entities.RouteAddress", "RouteAddress")
.WithMany("RouteAddressDetails")
.HasForeignKey("RouteAddressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_routeAddressDetails_routeAddress_routeAddressId");
b.HasOne("AutobusApi.Domain.Entities.VehicleEnrollment", "VehicleEnrollment")
.WithMany("RouteAddressDetails")
.HasForeignKey("VehicleEnrollmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_routeAddressDetails_vehicleEnrollments_vehicleEnrollmentId");
b.Navigation("RouteAddress");
b.Navigation("VehicleEnrollment");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Ticket", b =>
{
b.HasOne("AutobusApi.Domain.Entities.TicketGroup", "TicketGroup")
.WithMany("Tickets")
.HasForeignKey("TicketGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_tickets_ticketGroups_ticketGroupId");
b.HasOne("AutobusApi.Domain.Entities.VehicleEnrollment", "VehicleEnrollment")
.WithMany("Tickets")
.HasForeignKey("VehicleEnrollmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_tickets_vehicleEnrollments_vehicleEnrollmentId");
b.Navigation("TicketGroup");
b.Navigation("VehicleEnrollment");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TicketGroup", b =>
{
b.HasOne("AutobusApi.Domain.Entities.TicketDocument", "TicketDocument")
.WithOne("TicketGroup")
.HasForeignKey("AutobusApi.Domain.Entities.TicketGroup", "TicketDocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_ticketGroups_ticketDocuments_ticketDocumentId");
b.HasOne("AutobusApi.Domain.Entities.User", "User")
.WithMany("TicketGroups")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_ticketGroups_users_userId");
b.Navigation("TicketDocument");
b.Navigation("User");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TrainCarriage", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Carriage", "Carriage")
.WithMany("TrainCarriage")
.HasForeignKey("TrainId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_trainCarriages_trains_carriageId");
b.HasOne("AutobusApi.Domain.Entities.Train", "Train")
.WithMany("TrainCarriage")
.HasForeignKey("TrainId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_trainCarriages_trains_trainId");
b.Navigation("Carriage");
b.Navigation("Train");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Vehicle", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Company", "Company")
.WithMany("Vehicles")
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_vehicles_companies_companyId");
b.Navigation("Company");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.VehicleEnrollment", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Route", "Route")
.WithMany("VehicleEnrollments")
.HasForeignKey("RouteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_vehicleEnrollments_routes_routeId");
b.HasOne("AutobusApi.Domain.Entities.Vehicle", "Vehicle")
.WithMany("Enrollments")
.HasForeignKey("VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_vehicleEnrollments_vehicles_vehicleId");
b.Navigation("Route");
b.Navigation("Vehicle");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.VehicleEnrollmentEmployee", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Employee", "Employee")
.WithMany("Shifts")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_vehicleEnrollmentEmployees_employees_employeeId");
b.HasOne("AutobusApi.Domain.Entities.VehicleEnrollment", "VehicleEnrollment")
.WithMany("Crew")
.HasForeignKey("VehicleEnrollmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_vehicleEnrollmentEmployees_vehicleEnrollments_vehicleEnrollmentId");
b.Navigation("Employee");
b.Navigation("VehicleEnrollment");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Aircraft", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Vehicle", "Vehicle")
.WithOne()
.HasForeignKey("AutobusApi.Domain.Entities.Aircraft", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_aircrafts_vehicles_id");
b.Navigation("Vehicle");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Bus", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Vehicle", "Vehicle")
.WithOne()
.HasForeignKey("AutobusApi.Domain.Entities.Bus", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_buses_vehicles_id");
b.Navigation("Vehicle");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Train", b =>
{
b.HasOne("AutobusApi.Domain.Entities.Vehicle", "Vehicle")
.WithOne()
.HasForeignKey("AutobusApi.Domain.Entities.Train", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_trains_vehicles_id");
b.Navigation("Vehicle");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Address", b =>
{
b.Navigation("RouteAddresses");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Carriage", b =>
{
b.Navigation("TrainCarriage");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.City", b =>
{
b.Navigation("Addresses");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Company", b =>
{
b.Navigation("Employees");
b.Navigation("Vehicles");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Country", b =>
{
b.Navigation("Regions");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Employee", b =>
{
b.Navigation("Documents");
b.Navigation("Shifts");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Region", b =>
{
b.Navigation("Cities");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Route", b =>
{
b.Navigation("RouteAddresses");
b.Navigation("VehicleEnrollments");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.RouteAddress", b =>
{
b.Navigation("RouteAddressDetails");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TicketDocument", b =>
{
b.Navigation("TicketGroup")
.IsRequired();
});
modelBuilder.Entity("AutobusApi.Domain.Entities.TicketGroup", b =>
{
b.Navigation("Tickets");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.User", b =>
{
b.Navigation("Reviews");
b.Navigation("TicketGroups");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Vehicle", b =>
{
b.Navigation("Enrollments");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.VehicleEnrollment", b =>
{
b.Navigation("Crew");
b.Navigation("Reviews");
b.Navigation("RouteAddressDetails");
b.Navigation("Tickets");
});
modelBuilder.Entity("AutobusApi.Domain.Entities.Train", b =>
{
b.Navigation("TrainCarriage");
});
#pragma warning restore 612, 618
}
}
}