Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

luticate2Context.cs 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using Microsoft.EntityFrameworkCore;
  2. namespace Luticate2.Auth.Auth.DataAccess.Models
  3. {
  4. public partial class luticate2Context : DbContext
  5. {
  6. public luticate2Context()
  7. {
  8. }
  9. public luticate2Context(DbContextOptions<luticate2Context> options)
  10. : base(options)
  11. {
  12. }
  13. public virtual DbSet<LuGroups> LuGroups { get; set; }
  14. public virtual DbSet<LuGroupsObjects> LuGroupsObjects { get; set; }
  15. public virtual DbSet<LuObjectsMetadata> LuObjectsMetadata { get; set; }
  16. public virtual DbSet<LuUsers> LuUsers { get; set; }
  17. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  18. {
  19. if (!optionsBuilder.IsConfigured)
  20. {
  21. #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.
  22. optionsBuilder.UseNpgsql("Host=localhost;Database=luticate2;Username=dev;Password=dev");
  23. }
  24. }
  25. protected override void OnModelCreating(ModelBuilder modelBuilder)
  26. {
  27. modelBuilder.HasPostgresExtension("citext")
  28. .HasPostgresExtension("unaccent")
  29. .HasPostgresExtension("uuid-ossp");
  30. modelBuilder.Entity<LuGroups>(entity =>
  31. {
  32. entity.ToTable("lu_groups", "luticate2");
  33. entity.HasIndex(e => e.Name)
  34. .HasName("lu_groups_name_key")
  35. .IsUnique();
  36. entity.Property(e => e.Id)
  37. .HasColumnName("id")
  38. .HasDefaultValueSql("luticate2.lu_sp_generate_uuid('lu_groups'::text)");
  39. entity.Property(e => e.Name)
  40. .IsRequired()
  41. .HasColumnName("name")
  42. .HasColumnType("citext");
  43. entity.HasOne(d => d.IdNavigation)
  44. .WithOne(p => p.LuGroups)
  45. .HasForeignKey<LuGroups>(d => d.Id)
  46. .OnDelete(DeleteBehavior.ClientSetNull)
  47. .HasConstraintName("lu_groups_id_fkey");
  48. });
  49. modelBuilder.Entity<LuGroupsObjects>(entity =>
  50. {
  51. entity.HasKey(e => new { e.GroupId, e.ObjectId });
  52. entity.ToTable("lu_groups_objects", "luticate2");
  53. entity.HasIndex(e => new { e.ObjectId, e.Priority })
  54. .HasName("lu_groups_objects_object_id_priority_key")
  55. .IsUnique();
  56. entity.Property(e => e.GroupId).HasColumnName("group_id");
  57. entity.Property(e => e.ObjectId).HasColumnName("object_id");
  58. entity.Property(e => e.Priority).HasColumnName("priority");
  59. entity.HasOne(d => d.Group)
  60. .WithMany(p => p.LuGroupsObjects)
  61. .HasForeignKey(d => d.GroupId)
  62. .HasConstraintName("lu_groups_objects_group_id_fkey");
  63. entity.HasOne(d => d.Object)
  64. .WithMany(p => p.LuGroupsObjects)
  65. .HasForeignKey(d => d.ObjectId)
  66. .OnDelete(DeleteBehavior.ClientSetNull)
  67. .HasConstraintName("lu_groups_objects_object_id_fkey");
  68. });
  69. modelBuilder.Entity<LuObjectsMetadata>(entity =>
  70. {
  71. entity.ToTable("lu_objects_metadata", "luticate2");
  72. entity.Property(e => e.Id)
  73. .HasColumnName("id")
  74. .HasDefaultValueSql("luticate2.lu_sp_generate_uuid('lu_objects_metadata'::text)");
  75. entity.Property(e => e.CreatedAt)
  76. .HasColumnName("created_at")
  77. .HasColumnType("timestamp with time zone")
  78. .HasDefaultValueSql("now()");
  79. entity.Property(e => e.UpdatedAt)
  80. .HasColumnName("updated_at")
  81. .HasColumnType("timestamp with time zone");
  82. });
  83. modelBuilder.Entity<LuUsers>(entity =>
  84. {
  85. entity.ToTable("lu_users", "luticate2");
  86. entity.HasIndex(e => e.Username)
  87. .HasName("lu_users_username_key")
  88. .IsUnique();
  89. entity.Property(e => e.Id)
  90. .HasColumnName("id")
  91. .HasDefaultValueSql("luticate2.lu_sp_generate_uuid('lu_users'::text)");
  92. entity.Property(e => e.Username)
  93. .IsRequired()
  94. .HasColumnName("username")
  95. .HasColumnType("citext");
  96. entity.HasOne(d => d.IdNavigation)
  97. .WithOne(p => p.LuUsers)
  98. .HasForeignKey<LuUsers>(d => d.Id)
  99. .OnDelete(DeleteBehavior.ClientSetNull)
  100. .HasConstraintName("lu_users_id_fkey");
  101. });
  102. }
  103. }
  104. }