// using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Server.Data; #nullable disable namespace Server.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20221124184433_Add_TicketGroups")] partial class Add_TicketGroups { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "6.0.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") .HasColumnType("text"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("text"); b.Property("Name") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("NormalizedName") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("NormalizedName") .IsUnique() .HasDatabaseName("RoleNameIndex"); b.ToTable("AspNetRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ClaimType") .HasColumnType("text"); b.Property("ClaimValue") .HasColumnType("text"); b.Property("RoleId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("RoleId"); b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ClaimType") .HasColumnType("text"); b.Property("ClaimValue") .HasColumnType("text"); b.Property("UserId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") .HasColumnType("text"); b.Property("ProviderKey") .HasColumnType("text"); b.Property("ProviderDisplayName") .HasColumnType("text"); b.Property("UserId") .IsRequired() .HasColumnType("text"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") .HasColumnType("text"); b.Property("RoleId") .HasColumnType("text"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); b.ToTable("AspNetUserRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") .HasColumnType("text"); b.Property("LoginProvider") .HasColumnType("text"); b.Property("Name") .HasColumnType("text"); b.Property("Value") .HasColumnType("text"); b.HasKey("UserId", "LoginProvider", "Name"); b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("Server.Models.Address", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CityId") .HasColumnType("integer"); b.Property("Latitude") .HasColumnType("double precision"); b.Property("Longitude") .HasColumnType("double precision"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("CityId"); b.ToTable("Addresses"); }); modelBuilder.Entity("Server.Models.City", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("StateId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("StateId"); b.ToTable("Cities"); }); modelBuilder.Entity("Server.Models.Company", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("OwnerId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("OwnerId"); b.ToTable("Companies"); }); modelBuilder.Entity("Server.Models.Country", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Code") .IsRequired() .HasColumnType("text"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("Countries"); }); modelBuilder.Entity("Server.Models.Review", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Comment") .HasColumnType("text"); b.Property("PostDateTimeUtc") .HasColumnType("timestamp with time zone"); b.Property("Rating") .HasColumnType("integer"); b.Property("UserId") .IsRequired() .HasColumnType("text"); b.Property("VehicleEnrollmentId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("UserId"); b.HasIndex("VehicleEnrollmentId"); b.ToTable("Reviews"); }); modelBuilder.Entity("Server.Models.Route", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Type") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("Routes"); }); modelBuilder.Entity("Server.Models.RouteAddress", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AddressId") .HasColumnType("integer"); b.Property("CostToNextCity") .HasColumnType("double precision"); b.Property("Order") .HasColumnType("integer"); b.Property("RouteId") .HasColumnType("integer"); b.Property("TimeSpanToNextCity") .HasColumnType("interval"); b.Property("WaitTimeSpan") .HasColumnType("interval"); b.HasKey("Id"); b.HasIndex("AddressId"); b.HasIndex("RouteId"); b.ToTable("RouteAddresses"); }); modelBuilder.Entity("Server.Models.State", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CountryId") .HasColumnType("integer"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("CountryId"); b.ToTable("States"); }); modelBuilder.Entity("Server.Models.Ticket", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("FirstRouteAddressId") .HasColumnType("integer"); b.Property("IsMissed") .HasColumnType("boolean"); b.Property("IsReturned") .HasColumnType("boolean"); b.Property("LastRouteAddressId") .HasColumnType("integer"); b.Property("PurchaseDateTimeUtc") .HasColumnType("timestamp with time zone"); b.Property("TicketGroupId") .HasColumnType("integer"); b.Property("VehicleEnrollmentId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("TicketGroupId"); b.HasIndex("VehicleEnrollmentId"); b.ToTable("Tickets"); }); modelBuilder.Entity("Server.Models.TicketGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("UserId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("TicketGroups"); }); modelBuilder.Entity("Server.Models.User", b => { b.Property("Id") .HasColumnType("text"); b.Property("AccessFailedCount") .HasColumnType("integer"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("text"); b.Property("Email") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("EmailConfirmed") .HasColumnType("boolean"); b.Property("FirstName") .HasColumnType("text"); b.Property("LastName") .HasColumnType("text"); b.Property("LockoutEnabled") .HasColumnType("boolean"); b.Property("LockoutEnd") .HasColumnType("timestamp with time zone"); b.Property("NormalizedEmail") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("NormalizedUserName") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("PasswordHash") .HasColumnType("text"); b.Property("PhoneNumber") .HasColumnType("text"); b.Property("PhoneNumberConfirmed") .HasColumnType("boolean"); b.Property("SecurityStamp") .HasColumnType("text"); b.Property("TwoFactorEnabled") .HasColumnType("boolean"); b.Property("UserName") .HasMaxLength(256) .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("NormalizedEmail") .HasDatabaseName("EmailIndex"); b.HasIndex("NormalizedUserName") .IsUnique() .HasDatabaseName("UserNameIndex"); b.ToTable("AspNetUsers", (string)null); }); modelBuilder.Entity("Server.Models.Vehicle", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Capacity") .HasColumnType("integer"); b.Property("CompanyId") .HasColumnType("integer"); b.Property("HasBelts") .HasColumnType("boolean"); b.Property("HasClimateControl") .HasColumnType("boolean"); b.Property("HasOutlet") .HasColumnType("boolean"); b.Property("HasStewardess") .HasColumnType("boolean"); b.Property("HasTV") .HasColumnType("boolean"); b.Property("HasWC") .HasColumnType("boolean"); b.Property("HasWiFi") .HasColumnType("boolean"); b.Property("Number") .IsRequired() .HasColumnType("text"); b.Property("Type") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("CompanyId"); b.ToTable("Vehicles"); }); modelBuilder.Entity("Server.Models.VehicleEnrollment", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CancelationComment") .HasColumnType("text"); b.Property("DelayTimeSpan") .HasColumnType("interval"); b.Property("DepartureDateTimeUtc") .HasColumnType("timestamp with time zone"); b.Property("IsCanceled") .HasColumnType("boolean"); b.Property("RouteId") .HasColumnType("integer"); b.Property("VehicleId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("RouteId"); b.HasIndex("VehicleId"); b.ToTable("VehicleEnrollments"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.HasOne("Server.Models.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.HasOne("Server.Models.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Server.Models.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.HasOne("Server.Models.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Server.Models.Address", b => { b.HasOne("Server.Models.City", "City") .WithMany("Addresses") .HasForeignKey("CityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("City"); }); modelBuilder.Entity("Server.Models.City", b => { b.HasOne("Server.Models.State", "State") .WithMany("Cities") .HasForeignKey("StateId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("State"); }); modelBuilder.Entity("Server.Models.Company", b => { b.HasOne("Server.Models.User", "Owner") .WithMany() .HasForeignKey("OwnerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Owner"); }); modelBuilder.Entity("Server.Models.Review", b => { b.HasOne("Server.Models.User", "User") .WithMany("Reviews") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Server.Models.VehicleEnrollment", "VehicleEnrollment") .WithMany("Reviews") .HasForeignKey("VehicleEnrollmentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); b.Navigation("VehicleEnrollment"); }); modelBuilder.Entity("Server.Models.RouteAddress", b => { b.HasOne("Server.Models.Address", "Address") .WithMany("RouteAddresses") .HasForeignKey("AddressId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Server.Models.Route", "Route") .WithMany("RouteAddresses") .HasForeignKey("RouteId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Address"); b.Navigation("Route"); }); modelBuilder.Entity("Server.Models.State", b => { b.HasOne("Server.Models.Country", "Country") .WithMany("States") .HasForeignKey("CountryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Country"); }); modelBuilder.Entity("Server.Models.Ticket", b => { b.HasOne("Server.Models.TicketGroup", "TicketGroup") .WithMany("Tickets") .HasForeignKey("TicketGroupId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Server.Models.VehicleEnrollment", "VehicleEnrollment") .WithMany("Tickets") .HasForeignKey("VehicleEnrollmentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("TicketGroup"); b.Navigation("VehicleEnrollment"); }); modelBuilder.Entity("Server.Models.TicketGroup", b => { b.HasOne("Server.Models.User", "User") .WithMany("TicketGroups") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("Server.Models.User", b => { b.OwnsMany("Server.Models.RefreshToken", "RefreshTokens", b1 => { b1.Property("UserId") .HasColumnType("text"); b1.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); b1.Property("CreationDateTime") .HasColumnType("timestamp with time zone"); b1.Property("ExpiryDateTime") .HasColumnType("timestamp with time zone"); b1.Property("Revoked") .HasColumnType("timestamp with time zone"); b1.Property("Token") .IsRequired() .HasColumnType("text"); b1.HasKey("UserId", "Id"); b1.ToTable("RefreshToken"); b1.WithOwner() .HasForeignKey("UserId"); }); b.Navigation("RefreshTokens"); }); modelBuilder.Entity("Server.Models.Vehicle", b => { b.HasOne("Server.Models.Company", "Company") .WithMany("Vehicles") .HasForeignKey("CompanyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Company"); }); modelBuilder.Entity("Server.Models.VehicleEnrollment", b => { b.HasOne("Server.Models.Route", "Route") .WithMany("VehicleEnrollments") .HasForeignKey("RouteId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Server.Models.Vehicle", "Vehicle") .WithMany("VehicleEnrollments") .HasForeignKey("VehicleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Route"); b.Navigation("Vehicle"); }); modelBuilder.Entity("Server.Models.Address", b => { b.Navigation("RouteAddresses"); }); modelBuilder.Entity("Server.Models.City", b => { b.Navigation("Addresses"); }); modelBuilder.Entity("Server.Models.Company", b => { b.Navigation("Vehicles"); }); modelBuilder.Entity("Server.Models.Country", b => { b.Navigation("States"); }); modelBuilder.Entity("Server.Models.Route", b => { b.Navigation("RouteAddresses"); b.Navigation("VehicleEnrollments"); }); modelBuilder.Entity("Server.Models.State", b => { b.Navigation("Cities"); }); modelBuilder.Entity("Server.Models.TicketGroup", b => { b.Navigation("Tickets"); }); modelBuilder.Entity("Server.Models.User", b => { b.Navigation("Reviews"); b.Navigation("TicketGroups"); }); modelBuilder.Entity("Server.Models.Vehicle", b => { b.Navigation("VehicleEnrollments"); }); modelBuilder.Entity("Server.Models.VehicleEnrollment", b => { b.Navigation("Reviews"); b.Navigation("Tickets"); }); #pragma warning restore 612, 618 } } }