This repository has been archived by the owner on Sep 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#28 Added migration with database configuration for fts
- Loading branch information
Showing
8 changed files
with
657 additions
and
3 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...e.WebApp/Data/ConfigurationDataBase/ConfigurationPostgreSQL/ImageFtSearchConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using ImageBase.WebApp.Data.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
|
||
namespace ImageBase.WebApp.Data.ConfigurationDataBase.ConfigurationPostgreSQL | ||
{ | ||
public class ImageFtSearchConfiguration | ||
{ | ||
public ImageFtSearchConfiguration(EntityTypeBuilder<ImageFtSearch> entityBuilder) | ||
{ | ||
entityBuilder.HasKey(ifts => ifts.Id); | ||
entityBuilder.Property(ifts => ifts.Id).HasColumnName("id"); | ||
entityBuilder.HasOne(ifts => ifts.Image).WithOne(i => i.ImageFtSearch).HasForeignKey<ImageFtSearch>(ifts => ifts.ImageId).OnDelete(DeleteBehavior.Cascade); | ||
|
||
entityBuilder.Property(ifts => ifts.ImageId).HasColumnName("image_id").IsRequired(); | ||
entityBuilder.Property(ifts => ifts.ImageVector).HasColumnName("image_vector").IsRequired(); | ||
entityBuilder.Property(ifts => ifts.Id).ValueGeneratedOnAdd(); | ||
|
||
entityBuilder.ToTable("images_ft_search"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using NpgsqlTypes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace ImageBase.WebApp.Data.Models | ||
{ | ||
public class ImageFtSearch:BaseEntity<long> | ||
{ | ||
public long ImageId { get; set; } | ||
public NpgsqlTsVector ImageVector { get; set; } | ||
public Image Image { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.