123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- using Microsoft.EntityFrameworkCore;
-
- namespace Luticate2.Auth.Auth.DataAccess.Models
- {
- public partial class luticate2Context : DbContext
- {
- public luticate2Context()
- {
- }
-
- public luticate2Context(DbContextOptions<luticate2Context> options)
- : base(options)
- {
- }
-
- public virtual DbSet<LuGroups> LuGroups { get; set; }
- public virtual DbSet<LuGroupsObjects> LuGroupsObjects { get; set; }
- public virtual DbSet<LuObjectsMetadata> LuObjectsMetadata { get; set; }
- public virtual DbSet<LuUsers> 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<LuGroups>(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<LuGroups>(d => d.Id)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("lu_groups_id_fkey");
- });
-
- modelBuilder.Entity<LuGroupsObjects>(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<LuObjectsMetadata>(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<LuUsers>(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<LuUsers>(d => d.Id)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("lu_users_id_fkey");
- });
- }
- }
- }
|