mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(persistence): ♻ extract 'SegmentViewUrls' and 'SegmentViewUrlMirrors'
This commit is contained in:
parent
11148e0d19
commit
eb70b7e70e
7 changed files with 187 additions and 163 deletions
|
|
@ -35,4 +35,8 @@
|
|||
<ProjectReference Include="..\FilterLists.Directory.Infrastructure\FilterLists.Directory.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
// <auto-generated />
|
||||
|
||||
using System;
|
||||
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Migrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(QueryDbContext))]
|
||||
[Migration("20200824012903_Initial")]
|
||||
[Migration("20200825102124_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
|
|
@ -79,10 +80,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|||
b.Property<string>("SubmissionUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ViewUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LicenseId");
|
||||
|
|
@ -241,6 +238,52 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|||
b.ToTable("Merges");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrl", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("FilterListId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FilterListId", "Position")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SegmentViewUrls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrlMirror", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("SegmentViewUrlId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SegmentViewUrlId");
|
||||
|
||||
b.ToTable("SegmentViewUrlMirrors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
|
@ -325,44 +368,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlMirror", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("FilterListId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FilterListId");
|
||||
|
||||
b.ToTable("ViewUrlMirrors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlPartial", b =>
|
||||
{
|
||||
b.Property<int>("FilterListId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("FilterListId", "Position");
|
||||
|
||||
b.ToTable("ViewUrlPartials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependencyFilterList")
|
||||
|
|
@ -475,6 +480,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrl", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList")
|
||||
.WithMany("SegmentViewUrls")
|
||||
.HasForeignKey("FilterListId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrlMirror", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrl", "SegmentViewUrl")
|
||||
.WithMany("SegmentViewUrlMirrors")
|
||||
.HasForeignKey("SegmentViewUrlId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SoftwareSyntax", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", "Software")
|
||||
|
|
@ -489,24 +512,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlMirror", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList")
|
||||
.WithMany("ViewUrlMirrors")
|
||||
.HasForeignKey("FilterListId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlPartial", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList")
|
||||
.WithMany("ViewUrlPartials")
|
||||
.HasForeignKey("FilterListId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
|
@ -105,7 +105,6 @@ protected override void Up(MigrationBuilder migrationBuilder)
|
|||
Name = table.Column<string>(nullable: false),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
LicenseId = table.Column<int>(nullable: true),
|
||||
ViewUrl = table.Column<string>(nullable: false),
|
||||
HomeUrl = table.Column<string>(nullable: true),
|
||||
OnionUrl = table.Column<string>(nullable: true),
|
||||
PolicyUrl = table.Column<string>(nullable: true),
|
||||
|
|
@ -320,19 +319,20 @@ protected override void Up(MigrationBuilder migrationBuilder)
|
|||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewUrlMirrors",
|
||||
name: "SegmentViewUrls",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
FilterListId = table.Column<int>(nullable: false),
|
||||
Position = table.Column<int>(nullable: false),
|
||||
Url = table.Column<string>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewUrlMirrors", x => x.Id);
|
||||
table.PrimaryKey("PK_SegmentViewUrls", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewUrlMirrors_FilterLists_FilterListId",
|
||||
name: "FK_SegmentViewUrls_FilterLists_FilterListId",
|
||||
column: x => x.FilterListId,
|
||||
principalTable: "FilterLists",
|
||||
principalColumn: "Id",
|
||||
|
|
@ -340,20 +340,21 @@ protected override void Up(MigrationBuilder migrationBuilder)
|
|||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewUrlPartials",
|
||||
name: "SegmentViewUrlMirrors",
|
||||
columns: table => new
|
||||
{
|
||||
Position = table.Column<int>(nullable: false),
|
||||
FilterListId = table.Column<int>(nullable: false),
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SegmentViewUrlId = table.Column<int>(nullable: false),
|
||||
Url = table.Column<string>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewUrlPartials", x => new { x.FilterListId, x.Position });
|
||||
table.PrimaryKey("PK_SegmentViewUrlMirrors", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewUrlPartials_FilterLists_FilterListId",
|
||||
column: x => x.FilterListId,
|
||||
principalTable: "FilterLists",
|
||||
name: "FK_SegmentViewUrlMirrors_SegmentViewUrls_SegmentViewUrlId",
|
||||
column: x => x.SegmentViewUrlId,
|
||||
principalTable: "SegmentViewUrls",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
|
@ -398,15 +399,21 @@ protected override void Up(MigrationBuilder migrationBuilder)
|
|||
table: "Merges",
|
||||
column: "IncludesFilterListId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SegmentViewUrlMirrors_SegmentViewUrlId",
|
||||
table: "SegmentViewUrlMirrors",
|
||||
column: "SegmentViewUrlId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SegmentViewUrls_FilterListId_Position",
|
||||
table: "SegmentViewUrls",
|
||||
columns: new[] { "FilterListId", "Position" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SoftwareSyntaxes_SyntaxId",
|
||||
table: "SoftwareSyntaxes",
|
||||
column: "SyntaxId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewUrlMirrors_FilterListId",
|
||||
table: "ViewUrlMirrors",
|
||||
column: "FilterListId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
|
|
@ -432,15 +439,12 @@ protected override void Down(MigrationBuilder migrationBuilder)
|
|||
migrationBuilder.DropTable(
|
||||
name: "Merges");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SegmentViewUrlMirrors");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SoftwareSyntaxes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewUrlMirrors");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewUrlPartials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Languages");
|
||||
|
||||
|
|
@ -450,6 +454,9 @@ protected override void Down(MigrationBuilder migrationBuilder)
|
|||
migrationBuilder.DropTable(
|
||||
name: "Tags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SegmentViewUrls");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Software");
|
||||
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
// <auto-generated />
|
||||
|
||||
using System;
|
||||
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Migrations.Migrations
|
||||
|
|
@ -77,10 +78,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
b.Property<string>("SubmissionUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ViewUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LicenseId");
|
||||
|
|
@ -239,6 +236,52 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
b.ToTable("Merges");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrl", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("FilterListId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FilterListId", "Position")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SegmentViewUrls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrlMirror", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("SegmentViewUrlId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SegmentViewUrlId");
|
||||
|
||||
b.ToTable("SegmentViewUrlMirrors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
|
@ -323,44 +366,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlMirror", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("FilterListId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FilterListId");
|
||||
|
||||
b.ToTable("ViewUrlMirrors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlPartial", b =>
|
||||
{
|
||||
b.Property<int>("FilterListId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("FilterListId", "Position");
|
||||
|
||||
b.ToTable("ViewUrlPartials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependencyFilterList")
|
||||
|
|
@ -473,6 +478,24 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrl", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList")
|
||||
.WithMany("SegmentViewUrls")
|
||||
.HasForeignKey("FilterListId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrlMirror", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SegmentViewUrl", "SegmentViewUrl")
|
||||
.WithMany("SegmentViewUrlMirrors")
|
||||
.HasForeignKey("SegmentViewUrlId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SoftwareSyntax", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", "Software")
|
||||
|
|
@ -487,24 +510,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlMirror", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList")
|
||||
.WithMany("ViewUrlMirrors")
|
||||
.HasForeignKey("FilterListId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.ViewUrlPartial", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList")
|
||||
.WithMany("ViewUrlPartials")
|
||||
.HasForeignKey("FilterListId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ public class FilterList
|
|||
public IReadOnlyCollection<FilterListSyntax> FilterListSyntaxes { get; private set; } = new HashSet<FilterListSyntax>();
|
||||
public IReadOnlyCollection<FilterListLanguage> FilterListLanguages { get; private set; } = new HashSet<FilterListLanguage>();
|
||||
public IReadOnlyCollection<FilterListTag> FilterListTags { get; private set; } = new HashSet<FilterListTag>();
|
||||
public Uri ViewUrl { get; private set; } = null!;
|
||||
public IReadOnlyCollection<ViewUrlPartial> ViewUrlPartials { get; private set; } = new HashSet<ViewUrlPartial>();
|
||||
public IReadOnlyCollection<ViewUrlMirror> ViewUrlMirrors { get; private set; } = new HashSet<ViewUrlMirror>();
|
||||
public IReadOnlyCollection<SegmentViewUrl> SegmentViewUrls { get; private set; } = new HashSet<SegmentViewUrl>();
|
||||
public Uri? HomeUrl { get; private set; }
|
||||
public Uri? OnionUrl { get; private set; }
|
||||
public Uri? PolicyUrl { get; private set; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
|
@ -6,24 +7,28 @@
|
|||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
{
|
||||
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local")]
|
||||
public class ViewUrlPartial
|
||||
public class SegmentViewUrl
|
||||
{
|
||||
public FilterList FilterList { get; private set; } = null!;
|
||||
public int Position { get; private set; }
|
||||
public Uri Url { get; private set; } = null!;
|
||||
public IReadOnlyCollection<SegmentViewUrlMirror> SegmentViewUrlMirrors { get; private set; } = new HashSet<SegmentViewUrlMirror>();
|
||||
}
|
||||
|
||||
internal class ViewUrlPartialTypeConfiguration : IEntityTypeConfiguration<ViewUrlPartial>
|
||||
internal class ViewUrlPartialTypeConfiguration : IEntityTypeConfiguration<SegmentViewUrl>
|
||||
{
|
||||
public virtual void Configure(EntityTypeBuilder<ViewUrlPartial> builder)
|
||||
public virtual void Configure(EntityTypeBuilder<SegmentViewUrl> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
|
||||
builder.ToTable(nameof(ViewUrlPartial) + "s");
|
||||
builder.ToTable(nameof(SegmentViewUrl) + "s");
|
||||
|
||||
const string filterListId = nameof(ViewUrlPartial.FilterList) + "Id";
|
||||
builder.Property<int>(filterListId);
|
||||
builder.HasKey(filterListId, nameof(ViewUrlPartial.Position));
|
||||
const string segmentViewUrlId = "Id";
|
||||
builder.Property<int>(segmentViewUrlId);
|
||||
builder.HasKey(segmentViewUrlId);
|
||||
|
||||
builder.HasIndex(nameof(FilterList) + "Id", nameof(SegmentViewUrl.Position))
|
||||
.IsUnique();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,23 +6,23 @@
|
|||
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
||||
{
|
||||
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local")]
|
||||
public class ViewUrlMirror
|
||||
public class SegmentViewUrlMirror
|
||||
{
|
||||
public FilterList FilterList { get; private set; } = null!;
|
||||
public SegmentViewUrl SegmentViewUrl { get; private set; } = null!;
|
||||
public Uri Url { get; private set; } = null!;
|
||||
}
|
||||
|
||||
internal class ViewUrlMirrorTypeConfiguration : IEntityTypeConfiguration<ViewUrlMirror>
|
||||
internal class ViewUrlMirrorTypeConfiguration : IEntityTypeConfiguration<SegmentViewUrlMirror>
|
||||
{
|
||||
public virtual void Configure(EntityTypeBuilder<ViewUrlMirror> builder)
|
||||
public virtual void Configure(EntityTypeBuilder<SegmentViewUrlMirror> builder)
|
||||
{
|
||||
_ = builder ?? throw new ArgumentNullException(nameof(builder));
|
||||
|
||||
builder.ToTable(nameof(ViewUrlMirror) + "s");
|
||||
builder.ToTable(nameof(SegmentViewUrlMirror) + "s");
|
||||
|
||||
const string viewUrlMirrorId = "Id";
|
||||
builder.Property<int>(viewUrlMirrorId);
|
||||
builder.HasKey(viewUrlMirrorId);
|
||||
const string segmentViewUrlMirrorId = "Id";
|
||||
builder.Property<int>(segmentViewUrlMirrorId);
|
||||
builder.HasKey(segmentViewUrlMirrorId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue