|
@@ -0,0 +1,224 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
+
|
|
|
+namespace UPtur..Models;
|
|
|
+
|
|
|
+public partial class UpPrytovContext : DbContext
|
|
|
+{
|
|
|
+ public UpPrytovContext()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public UpPrytovContext(DbContextOptions<UpPrytovContext> options)
|
|
|
+ : base(options)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public virtual DbSet<Country> Countries { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<Hotel> Hotels { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<HotelComment> HotelComments { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<HotelImage> HotelImages { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<HotelOfTour> HotelOfTours { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<Tour> Tours { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<Type> Types { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<TypeOfTour> TypeOfTours { get; set; }
|
|
|
+
|
|
|
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
+#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
|
|
|
+ => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=UP_Prytov;Username=43P;Password=444444");
|
|
|
+
|
|
|
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
+ {
|
|
|
+ modelBuilder.Entity<Country>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Code).HasName("country_pk");
|
|
|
+
|
|
|
+ entity.ToTable("country");
|
|
|
+
|
|
|
+ entity.Property(e => e.Code)
|
|
|
+ .HasMaxLength(2)
|
|
|
+ .IsFixedLength()
|
|
|
+ .HasColumnName("code");
|
|
|
+ entity.Property(e => e.Name)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("name");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<Hotel>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("hotel_pk");
|
|
|
+
|
|
|
+ entity.ToTable("hotel");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.CountOfStars).HasColumnName("count_of_stars");
|
|
|
+ entity.Property(e => e.CountryCode)
|
|
|
+ .HasMaxLength(2)
|
|
|
+ .IsFixedLength()
|
|
|
+ .HasColumnName("country_code");
|
|
|
+ entity.Property(e => e.Description)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("description");
|
|
|
+ entity.Property(e => e.Name)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("name");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.CountryCodeNavigation).WithMany(p => p.Hotels)
|
|
|
+ .HasForeignKey(d => d.CountryCode)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("hotel_country_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<HotelComment>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("hotel_comment_pk");
|
|
|
+
|
|
|
+ entity.ToTable("hotel_comment");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.Author)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("author");
|
|
|
+ entity.Property(e => e.CreationDate).HasColumnName("creation_date");
|
|
|
+ entity.Property(e => e.HotelId).HasColumnName("hotel_id");
|
|
|
+ entity.Property(e => e.Text)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("text");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Hotel).WithMany(p => p.HotelComments)
|
|
|
+ .HasForeignKey(d => d.HotelId)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("hotel_comment_hotel_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<HotelImage>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("hotel_image_pk");
|
|
|
+
|
|
|
+ entity.ToTable("hotel_image");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .ValueGeneratedNever()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.HotelId).HasColumnName("hotel_id");
|
|
|
+ entity.Property(e => e.ImageSource).HasColumnName("image_source");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Hotel).WithMany(p => p.HotelImages)
|
|
|
+ .HasForeignKey(d => d.HotelId)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("hotel_image_hotel_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<HotelOfTour>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("hotel_of_tour_pk");
|
|
|
+
|
|
|
+ entity.ToTable("hotel_of_tour");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.HotelId).HasColumnName("hotel_id");
|
|
|
+ entity.Property(e => e.TourId).HasColumnName("tour_id");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Hotel).WithMany(p => p.HotelOfTours)
|
|
|
+ .HasForeignKey(d => d.HotelId)
|
|
|
+ .HasConstraintName("hotel_of_tour_hotel_fk");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Tour).WithMany(p => p.HotelOfTours)
|
|
|
+ .HasForeignKey(d => d.TourId)
|
|
|
+ .HasConstraintName("hotel_of_tour_tour_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<Tour>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("tour_pk");
|
|
|
+
|
|
|
+ entity.ToTable("tour");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.Desription)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("desription");
|
|
|
+ entity.Property(e => e.ImagePreview).HasColumnName("image_preview");
|
|
|
+ entity.Property(e => e.IsActual)
|
|
|
+ .HasColumnType("bit(1)")
|
|
|
+ .HasColumnName("is_actual");
|
|
|
+ entity.Property(e => e.Name)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("name");
|
|
|
+ entity.Property(e => e.Price)
|
|
|
+ .HasColumnType("money")
|
|
|
+ .HasColumnName("price");
|
|
|
+ entity.Property(e => e.TicketCount).HasColumnName("ticket_count");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<Type>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("type_pk");
|
|
|
+
|
|
|
+ entity.ToTable("type");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.Description)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("description");
|
|
|
+ entity.Property(e => e.Name)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("name");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<TypeOfTour>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("type_of_tour_pk");
|
|
|
+
|
|
|
+ entity.ToTable("type_of_tour");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.TourId).HasColumnName("tour_id");
|
|
|
+ entity.Property(e => e.TypeId).HasColumnName("type_id");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Tour).WithMany(p => p.TypeOfTours)
|
|
|
+ .HasForeignKey(d => d.TourId)
|
|
|
+ .HasConstraintName("type_of_tour_tour_fk");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Type).WithMany(p => p.TypeOfTours)
|
|
|
+ .HasForeignKey(d => d.TypeId)
|
|
|
+ .HasConstraintName("type_of_tour_type_fk");
|
|
|
+ });
|
|
|
+ modelBuilder.HasSequence("hotel_comment_id_seq").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("hotel_comment_id_seq1").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("hotel_id_seq").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("hotel_id_seq1").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("hotel_of_tour_id_seq").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("hotel_of_tour_id_seq1").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("tour_id_seq").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("tour_id_seq1").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("type_id_seq").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("type_id_seq1").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("type_of_tour_id_seq").HasMax(2147483647L);
|
|
|
+ modelBuilder.HasSequence("type_of_tour_id_seq1").HasMax(2147483647L);
|
|
|
+
|
|
|
+ OnModelCreatingPartial(modelBuilder);
|
|
|
+ }
|
|
|
+
|
|
|
+ partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
|
+}
|