Generation db
This commit is contained in:
parent
475fb89528
commit
e843bcc4cc
13
Subd/CountryView.cs
Normal file
13
Subd/CountryView.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class CountryView
|
||||||
|
{
|
||||||
|
public string? Country { get; set; }
|
||||||
|
|
||||||
|
public int? Date { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
17
Subd/Director.cs
Normal file
17
Subd/Director.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class Director
|
||||||
|
{
|
||||||
|
public int IdDirector { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
public int? Date { get; set; }
|
||||||
|
|
||||||
|
public string? Country { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Film> Films { get; set; } = new List<Film>();
|
||||||
|
}
|
27
Subd/Film.cs
Normal file
27
Subd/Film.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class Film
|
||||||
|
{
|
||||||
|
public int IdFilm { get; set; }
|
||||||
|
|
||||||
|
public string? NameFilm { get; set; }
|
||||||
|
|
||||||
|
public string? Genre { get; set; }
|
||||||
|
|
||||||
|
public string? Country { get; set; }
|
||||||
|
|
||||||
|
public int? IdDirector { get; set; }
|
||||||
|
|
||||||
|
public int? IdStudio { get; set; }
|
||||||
|
|
||||||
|
public float? CoastRenta { get; set; }
|
||||||
|
|
||||||
|
public float? CoastBuy { get; set; }
|
||||||
|
|
||||||
|
public virtual Director? IdDirectorNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual Studio? IdStudioNavigation { get; set; }
|
||||||
|
}
|
188
Subd/Onlinecinema2Context.cs
Normal file
188
Subd/Onlinecinema2Context.cs
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class Onlinecinema2Context : DbContext
|
||||||
|
{
|
||||||
|
public Onlinecinema2Context()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Onlinecinema2Context(DbContextOptions<Onlinecinema2Context> options)
|
||||||
|
: base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DbSet<CountryView> CountryViews { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Director> Directors { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Film> Films { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<ParentCompany> ParentCompanies { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Studio> Studios { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<UsaView> UsaViews { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<User> Users { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<UserRating> UserRatings { 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=localhost;Port=5432;Database=onlinecinema2;Username=postgres;Password=12345");
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<CountryView>(entity =>
|
||||||
|
{
|
||||||
|
entity
|
||||||
|
.HasNoKey()
|
||||||
|
.ToView("country_view");
|
||||||
|
|
||||||
|
entity.Property(e => e.Country)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("country");
|
||||||
|
entity.Property(e => e.Date).HasColumnName("date");
|
||||||
|
entity.Property(e => e.Name)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Director>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.IdDirector).HasName("director_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("director");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdDirector).HasColumnName("id_director");
|
||||||
|
entity.Property(e => e.Country)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("country");
|
||||||
|
entity.Property(e => e.Date).HasColumnName("date");
|
||||||
|
entity.Property(e => e.Name)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Film>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.IdFilm).HasName("films_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("films");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdFilm).HasColumnName("id_film");
|
||||||
|
entity.Property(e => e.CoastBuy).HasColumnName("coast_buy");
|
||||||
|
entity.Property(e => e.CoastRenta).HasColumnName("coast_renta");
|
||||||
|
entity.Property(e => e.Country)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("country");
|
||||||
|
entity.Property(e => e.Genre)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("genre");
|
||||||
|
entity.Property(e => e.IdDirector).HasColumnName("id_director");
|
||||||
|
entity.Property(e => e.IdStudio).HasColumnName("id_studio");
|
||||||
|
entity.Property(e => e.NameFilm)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name_film");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdDirectorNavigation).WithMany(p => p.Films)
|
||||||
|
.HasForeignKey(d => d.IdDirector)
|
||||||
|
.HasConstraintName("films_id_director_fkey");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdStudioNavigation).WithMany(p => p.Films)
|
||||||
|
.HasForeignKey(d => d.IdStudio)
|
||||||
|
.HasConstraintName("films_id_studio_fkey");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<ParentCompany>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.IdParentCompany).HasName("parent_company_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("parent_company");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdParentCompany).HasColumnName("id_parent_company");
|
||||||
|
entity.Property(e => e.Country)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("country");
|
||||||
|
entity.Property(e => e.Date).HasColumnName("date");
|
||||||
|
entity.Property(e => e.Name)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Studio>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.IdStudio).HasName("studio_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("studio");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdStudio).HasColumnName("id_studio");
|
||||||
|
entity.Property(e => e.Country)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("country");
|
||||||
|
entity.Property(e => e.Date).HasColumnName("date");
|
||||||
|
entity.Property(e => e.IdParentCompany).HasColumnName("id_parent_company");
|
||||||
|
entity.Property(e => e.Name)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdParentCompanyNavigation).WithMany(p => p.Studios)
|
||||||
|
.HasForeignKey(d => d.IdParentCompany)
|
||||||
|
.HasConstraintName("studio_id_parent_company_fkey");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<UsaView>(entity =>
|
||||||
|
{
|
||||||
|
entity
|
||||||
|
.HasNoKey()
|
||||||
|
.ToView("usa_view");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdFilm).HasColumnName("id_film");
|
||||||
|
entity.Property(e => e.NameFilm)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name_film");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<User>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.IdUser).HasName("users_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("users");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdUser).HasColumnName("id_user");
|
||||||
|
entity.Property(e => e.Nikname)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("nikname");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<UserRating>(entity =>
|
||||||
|
{
|
||||||
|
entity
|
||||||
|
.HasNoKey()
|
||||||
|
.ToTable("user_rating");
|
||||||
|
|
||||||
|
entity.Property(e => e.IdFilm).HasColumnName("id_film");
|
||||||
|
entity.Property(e => e.IdUser).HasColumnName("id_user");
|
||||||
|
entity.Property(e => e.Rating).HasColumnName("rating");
|
||||||
|
entity.Property(e => e.Reviev)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasColumnName("reviev");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdFilmNavigation).WithMany()
|
||||||
|
.HasForeignKey(d => d.IdFilm)
|
||||||
|
.HasConstraintName("user_rating_id_film_fkey");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdUserNavigation).WithMany()
|
||||||
|
.HasForeignKey(d => d.IdUser)
|
||||||
|
.HasConstraintName("user_rating_id_user_fkey");
|
||||||
|
});
|
||||||
|
|
||||||
|
OnModelCreatingPartial(modelBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||||
|
}
|
17
Subd/ParentCompany.cs
Normal file
17
Subd/ParentCompany.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class ParentCompany
|
||||||
|
{
|
||||||
|
public int IdParentCompany { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
public int? Date { get; set; }
|
||||||
|
|
||||||
|
public string? Country { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Studio> Studios { get; set; } = new List<Studio>();
|
||||||
|
}
|
21
Subd/Studio.cs
Normal file
21
Subd/Studio.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class Studio
|
||||||
|
{
|
||||||
|
public int IdStudio { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
public int? Date { get; set; }
|
||||||
|
|
||||||
|
public string? Country { get; set; }
|
||||||
|
|
||||||
|
public int? IdParentCompany { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Film> Films { get; set; } = new List<Film>();
|
||||||
|
|
||||||
|
public virtual ParentCompany? IdParentCompanyNavigation { get; set; }
|
||||||
|
}
|
@ -7,4 +7,13 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ConsoleTableExt" Version="3.2.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
11
Subd/UsaView.cs
Normal file
11
Subd/UsaView.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class UsaView
|
||||||
|
{
|
||||||
|
public int? IdFilm { get; set; }
|
||||||
|
|
||||||
|
public string? NameFilm { get; set; }
|
||||||
|
}
|
11
Subd/User.cs
Normal file
11
Subd/User.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class User
|
||||||
|
{
|
||||||
|
public int IdUser { get; set; }
|
||||||
|
|
||||||
|
public string? Nikname { get; set; }
|
||||||
|
}
|
19
Subd/UserRating.cs
Normal file
19
Subd/UserRating.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Subd;
|
||||||
|
|
||||||
|
public partial class UserRating
|
||||||
|
{
|
||||||
|
public int? IdFilm { get; set; }
|
||||||
|
|
||||||
|
public int? IdUser { get; set; }
|
||||||
|
|
||||||
|
public string? Reviev { get; set; }
|
||||||
|
|
||||||
|
public int? Rating { get; set; }
|
||||||
|
|
||||||
|
public virtual Film? IdFilmNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual User? IdUserNavigation { get; set; }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user