//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using RouteGuideDatabaseImplement;
#nullable disable
namespace RouteGuideDatabaseImplement.Migrations
{
[DbContext(typeof(RouteGuideDatabase))]
[Migration("20240407200755_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.13")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Driver", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Experience")
.HasColumnType("integer");
b.Property("FullName")
.IsRequired()
.HasColumnType("text");
b.Property("Phone")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Drivers");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Route", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("TransportId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TransportId");
b.ToTable("Routes");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.RouteStop", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Number")
.HasColumnType("integer");
b.Property("RouteId")
.HasColumnType("integer");
b.Property("StopId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("RouteId");
b.HasIndex("StopId");
b.ToTable("RouteStops");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Schedule", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ArrivalTime")
.HasColumnType("timestamp with time zone");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("DepartureTime")
.HasColumnType("timestamp with time zone");
b.Property("Frequency")
.HasColumnType("timestamp with time zone");
b.Property("RouteId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("RouteId");
b.ToTable("Schedules");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Stop", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Number")
.HasColumnType("integer");
b.Property("Street")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Stops");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Transport", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Capacity")
.HasColumnType("integer");
b.Property("DriverId")
.HasColumnType("integer");
b.Property("License")
.IsRequired()
.HasColumnType("text");
b.Property("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DriverId");
b.ToTable("Transport");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Route", b =>
{
b.HasOne("RouteGuideDatabaseImplement.Models.Transport", "Transport")
.WithMany()
.HasForeignKey("TransportId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Transport");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.RouteStop", b =>
{
b.HasOne("RouteGuideDatabaseImplement.Models.Route", "Route")
.WithMany("Stops")
.HasForeignKey("RouteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RouteGuideDatabaseImplement.Models.Stop", "Stop")
.WithMany()
.HasForeignKey("StopId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Route");
b.Navigation("Stop");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Schedule", b =>
{
b.HasOne("RouteGuideDatabaseImplement.Models.Route", "Route")
.WithMany()
.HasForeignKey("RouteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Route");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Transport", b =>
{
b.HasOne("RouteGuideDatabaseImplement.Models.Driver", "Driver")
.WithMany()
.HasForeignKey("DriverId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Driver");
});
modelBuilder.Entity("RouteGuideDatabaseImplement.Models.Route", b =>
{
b.Navigation("Stops");
});
#pragma warning restore 612, 618
}
}
}