27 lines
705 B
C#
27 lines
705 B
C#
using Chrono.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Server.Models;
|
|
|
|
namespace Server;
|
|
|
|
public class AppDbContext : DbContext
|
|
{
|
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
public DbSet<CardNote> CardNotes { get; set; }
|
|
public DbSet<UserDeck> UserDecks { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<CardNote>().HasKey(n => n.CardName);
|
|
|
|
modelBuilder.Entity<UserDeck>(b =>
|
|
{
|
|
b.HasKey(d => d.Id);
|
|
b.Property(d => d.Cards).HasColumnType("jsonb");
|
|
b.Property(d => d.Divers).HasColumnType("jsonb");
|
|
});
|
|
}
|
|
} |