mirror of
https://github.com/skoelle/focusapp.git
synced 2026-09-17 20:10:25 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user