Skip to content

Commit

Permalink
add searching by partial ip address
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidMax committed Apr 4, 2022
1 parent dd569b6 commit bab3995
Show file tree
Hide file tree
Showing 19 changed files with 10,085 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Data/Context/DatabaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
ent.Property(_alias => _alias.SearchableName).HasMaxLength(24);
ent.HasIndex(_alias => _alias.SearchableName);
ent.HasIndex(_alias => new {_alias.Name, _alias.IPAddress});
ent.Property(alias => alias.SearchableIPAddress)
.HasComputedColumnSql(@"((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", stored: true);
ent.HasIndex(alias => alias.SearchableIPAddress);
});

modelBuilder.Entity<EFMeta>(ent =>
Expand Down
Loading

0 comments on commit bab3995

Please sign in to comment.