using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Seasoned.Backend.Models; namespace Seasoned.Backend.Data; public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet Recipes { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); if (Database.IsNpgsql()) { modelBuilder.HasPostgresExtension("vector"); } modelBuilder.Entity(entity => { entity.HasOne() .WithMany() .HasForeignKey(r => r.UserId); if (Database.ProviderName == "Microsoft.EntityFrameworkCore.InMemory") { entity.Ignore(r => r.Embedding); } else { entity.Property(r => r.Embedding) .HasColumnType("vector(768)"); } }); } }