Infrasctructure: Update StreetDBContext with Street Entity
This commit is contained in:
parent
3a40657b1d
commit
226e5e4e3e
@ -2,6 +2,23 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
public class StreetDbContext : DbContext
|
||||
{
|
||||
public DbSet<Street> Streets { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasPostgresExtension("postgis");
|
||||
|
||||
modelBuilder.Entity<Street>(entity =>
|
||||
{
|
||||
entity.HasKey(s => s.Name);
|
||||
|
||||
entity.Property(s => s.Capacity).IsRequired();
|
||||
|
||||
entity.Property(s => s.Geometry).HasColumnType("geometry(LineString,4326)").IsRequired();
|
||||
|
||||
entity.Property(s => s.Version).IsRowVersion();
|
||||
});
|
||||
}
|
||||
public StreetDbContext(DbContextOptions<StreetDbContext> options) : base(options)
|
||||
{
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user