using Microsoft.EntityFrameworkCore; namespace Luticate2.Auth.Auth.DataAccess.Models { public partial class luticate2Context : DbContext { public luticate2Context() { } public luticate2Context(DbContextOptions options) : base(options) { } public virtual DbSet LuGroups { get; set; } public virtual DbSet LuGroupsObjects { get; set; } public virtual DbSet LuObjectsMetadata { get; set; } public virtual DbSet LuUsers { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. optionsBuilder.UseNpgsql("Host=localhost;Database=luticate2;Username=dev;Password=dev"); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasPostgresExtension("citext") .HasPostgresExtension("unaccent") .HasPostgresExtension("uuid-ossp"); modelBuilder.Entity(entity => { entity.ToTable("lu_groups", "luticate2"); entity.HasIndex(e => e.Name) .HasName("lu_groups_name_key") .IsUnique(); entity.Property(e => e.Id) .HasColumnName("id") .HasDefaultValueSql("luticate2.lu_sp_generate_uuid('lu_groups'::text)"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasColumnType("citext"); entity.HasOne(d => d.IdNavigation) .WithOne(p => p.LuGroups) .HasForeignKey(d => d.Id) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("lu_groups_id_fkey"); }); modelBuilder.Entity(entity => { entity.HasKey(e => new { e.GroupId, e.ObjectId }); entity.ToTable("lu_groups_objects", "luticate2"); entity.HasIndex(e => new { e.ObjectId, e.Priority }) .HasName("lu_groups_objects_object_id_priority_key") .IsUnique(); entity.Property(e => e.GroupId).HasColumnName("group_id"); entity.Property(e => e.ObjectId).HasColumnName("object_id"); entity.Property(e => e.Priority).HasColumnName("priority"); entity.HasOne(d => d.Group) .WithMany(p => p.LuGroupsObjects) .HasForeignKey(d => d.GroupId) .HasConstraintName("lu_groups_objects_group_id_fkey"); entity.HasOne(d => d.Object) .WithMany(p => p.LuGroupsObjects) .HasForeignKey(d => d.ObjectId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("lu_groups_objects_object_id_fkey"); }); modelBuilder.Entity(entity => { entity.ToTable("lu_objects_metadata", "luticate2"); entity.Property(e => e.Id) .HasColumnName("id") .HasDefaultValueSql("luticate2.lu_sp_generate_uuid('lu_objects_metadata'::text)"); entity.Property(e => e.CreatedAt) .HasColumnName("created_at") .HasColumnType("timestamp with time zone") .HasDefaultValueSql("now()"); entity.Property(e => e.UpdatedAt) .HasColumnName("updated_at") .HasColumnType("timestamp with time zone"); }); modelBuilder.Entity(entity => { entity.ToTable("lu_users", "luticate2"); entity.HasIndex(e => e.Username) .HasName("lu_users_username_key") .IsUnique(); entity.Property(e => e.Id) .HasColumnName("id") .HasDefaultValueSql("luticate2.lu_sp_generate_uuid('lu_users'::text)"); entity.Property(e => e.Username) .IsRequired() .HasColumnName("username") .HasColumnType("citext"); entity.HasOne(d => d.IdNavigation) .WithOne(p => p.LuUsers) .HasForeignKey(d => d.Id) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("lu_users_id_fkey"); }); } } }