mirror of
https://github.com/skoelle/focusapp.git
synced 2026-09-17 20:10:25 +00:00
31 lines
974 B
C#
31 lines
974 B
C#
// Copyright (c) 2026 Stefan Koelle (https://stefankoelle.de)
|
|
// Licensed under the MIT License. See LICENSE file in project root for details.
|
|
using FocusApp.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace FocusApp.Data;
|
|
|
|
public class FocusContext : DbContext
|
|
{
|
|
public DbSet<FocusTask> FocusTasks { get; set; }
|
|
|
|
public FocusContext(DbContextOptions<FocusContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
modelBuilder.Entity<FocusTask>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Title).IsRequired().HasMaxLength(255);
|
|
entity.Property(e => e.Description).HasMaxLength(2000);
|
|
entity.Property(e => e.Order).IsRequired();
|
|
entity.Property(e => e.CreatedAt).IsRequired();
|
|
entity.Property(e => e.UpdatedAt).IsRequired();
|
|
});
|
|
}
|
|
}
|