diff --git a/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/20240601133712_InitialCreate.Designer.cs b/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/20240601133712_InitialCreate.Designer.cs new file mode 100644 index 000000000..078418f43 --- /dev/null +++ b/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/20240601133712_InitialCreate.Designer.cs @@ -0,0 +1,668 @@ +// +using FilterLists.Directory.Infrastructure.Persistence.Queries.Context; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FilterLists.Directory.Infrastructure.Migrations.Migrations +{ + [DbContext(typeof(QueryDbContext))] + [Migration("20240601133712_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Latin1_General_100_CI_AS_SC") + .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b => + { + b.Property("DependencyFilterListId") + .HasColumnType("int"); + + b.Property("DependentFilterListId") + .HasColumnType("int"); + + b.HasKey("DependencyFilterListId", "DependentFilterListId"); + + b.HasIndex("DependentFilterListId"); + + b.ToTable("Dependent"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ChatUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DonateUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("EmailAddress") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ForumUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("HomeUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("IssuesUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("LicenseId") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(5); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("OnionUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("PolicyUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("SubmissionUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("LicenseId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("FilterLists"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListLanguage", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("LanguageId") + .HasColumnType("smallint"); + + b.HasKey("FilterListId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("FilterListLanguage"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListMaintainer", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("MaintainerId") + .HasColumnType("int"); + + b.HasKey("FilterListId", "MaintainerId"); + + b.HasIndex("MaintainerId"); + + b.ToTable("FilterListMaintainer"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListSyntax", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("SyntaxId") + .HasColumnType("smallint"); + + b.HasKey("FilterListId", "SyntaxId"); + + b.HasIndex("SyntaxId"); + + b.ToTable("FilterListSyntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListTag", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("TagId") + .HasColumnType("int"); + + b.HasKey("FilterListId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("FilterListTag"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Fork", b => + { + b.Property("UpstreamFilterListId") + .HasColumnType("int"); + + b.Property("ForkFilterListId") + .HasColumnType("int"); + + b.HasKey("UpstreamFilterListId", "ForkFilterListId"); + + b.HasIndex("ForkFilterListId"); + + b.ToTable("Fork"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Iso6391") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("nchar(2)") + .IsFixedLength(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Iso6391") + .IsUnique(); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Languages"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PermitsCommercialUse") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("PermitsDistribution") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("PermitsModification") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Licenses"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EmailAddress") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TwitterHandle") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Maintainers"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Merge", b => + { + b.Property("IncludedInFilterListId") + .HasColumnType("int"); + + b.Property("IncludesFilterListId") + .HasColumnType("int"); + + b.HasKey("IncludedInFilterListId", "IncludesFilterListId"); + + b.HasIndex("IncludesFilterListId"); + + b.ToTable("Merge"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DownloadUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("HomeUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SupportsAbpUrlScheme") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Software"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SoftwareSyntax", b => + { + b.Property("SoftwareId") + .HasColumnType("smallint"); + + b.Property("SyntaxId") + .HasColumnType("smallint"); + + b.HasKey("SoftwareId", "SyntaxId"); + + b.HasIndex("SyntaxId"); + + b.ToTable("SoftwareSyntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Syntaxes"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependencyFilterList") + .WithMany("DependentFilterLists") + .HasForeignKey("DependencyFilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependentFilterList") + .WithMany("DependencyFilterLists") + .HasForeignKey("DependentFilterListId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("DependencyFilterList"); + + b.Navigation("DependentFilterList"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", "License") + .WithMany("FilterLists") + .HasForeignKey("LicenseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListViewUrl", "ViewUrls", b1 => + { + b1.Property("FilterListId") + .HasColumnType("int"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Primariness") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)1); + + b1.Property("SegmentNumber") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)1); + + b1.Property("Url") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b1.HasKey("FilterListId", "Id"); + + b1.HasIndex("FilterListId", "SegmentNumber", "Primariness") + .IsUnique(); + + b1.ToTable("FilterListViewUrl"); + + b1.WithOwner("FilterList") + .HasForeignKey("FilterListId"); + + b1.Navigation("FilterList"); + }); + + b.Navigation("License"); + + b.Navigation("ViewUrls"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListLanguage", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListLanguages") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", "Language") + .WithMany("FilterListLanguages") + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListMaintainer", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListMaintainers") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", "Maintainer") + .WithMany("FilterListMaintainers") + .HasForeignKey("MaintainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Maintainer"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListSyntax", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListSyntaxes") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", "Syntax") + .WithMany("FilterListSyntaxes") + .HasForeignKey("SyntaxId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Syntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListTag", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListTags") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", "Tag") + .WithMany("FilterListTags") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Fork", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "ForkFilterList") + .WithMany("UpstreamFilterLists") + .HasForeignKey("ForkFilterListId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "UpstreamFilterList") + .WithMany("ForkFilterLists") + .HasForeignKey("UpstreamFilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ForkFilterList"); + + b.Navigation("UpstreamFilterList"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Merge", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "IncludedInFilterList") + .WithMany("IncludesFilterLists") + .HasForeignKey("IncludedInFilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "IncludesFilterList") + .WithMany("IncludedInFilterLists") + .HasForeignKey("IncludesFilterListId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("IncludedInFilterList"); + + b.Navigation("IncludesFilterList"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SoftwareSyntax", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", "Software") + .WithMany("SoftwareSyntaxes") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", "Syntax") + .WithMany("SoftwareSyntaxes") + .HasForeignKey("SyntaxId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Software"); + + b.Navigation("Syntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b => + { + b.Navigation("DependencyFilterLists"); + + b.Navigation("DependentFilterLists"); + + b.Navigation("FilterListLanguages"); + + b.Navigation("FilterListMaintainers"); + + b.Navigation("FilterListSyntaxes"); + + b.Navigation("FilterListTags"); + + b.Navigation("ForkFilterLists"); + + b.Navigation("IncludedInFilterLists"); + + b.Navigation("IncludesFilterLists"); + + b.Navigation("UpstreamFilterLists"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", b => + { + b.Navigation("FilterListLanguages"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", b => + { + b.Navigation("FilterLists"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", b => + { + b.Navigation("FilterListMaintainers"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b => + { + b.Navigation("SoftwareSyntaxes"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", b => + { + b.Navigation("FilterListSyntaxes"); + + b.Navigation("SoftwareSyntaxes"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", b => + { + b.Navigation("FilterListTags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/20240601133712_InitialCreate.cs b/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/20240601133712_InitialCreate.cs new file mode 100644 index 000000000..7b41c7062 --- /dev/null +++ b/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/20240601133712_InitialCreate.cs @@ -0,0 +1,499 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FilterLists.Directory.Infrastructure.Migrations.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Languages", + columns: table => new + { + Id = table.Column(type: "smallint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Iso6391 = table.Column(type: "nchar(2)", fixedLength: true, maxLength: 2, nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Languages", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Licenses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Url = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + PermitsModification = table.Column(type: "bit", nullable: false, defaultValue: false), + PermitsDistribution = table.Column(type: "bit", nullable: false, defaultValue: false), + PermitsCommercialUse = table.Column(type: "bit", nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Licenses", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Maintainers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Url = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + EmailAddress = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TwitterHandle = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Maintainers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Software", + columns: table => new + { + Id = table.Column(type: "smallint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + HomeUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + DownloadUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + SupportsAbpUrlScheme = table.Column(type: "bit", nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Software", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Syntaxes", + columns: table => new + { + Id = table.Column(type: "smallint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + Url = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Syntaxes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Tags", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Tags", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "FilterLists", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + LicenseId = table.Column(type: "int", nullable: false, defaultValue: 5), + HomeUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + OnionUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + PolicyUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + SubmissionUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + IssuesUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + ForumUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + ChatUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + EmailAddress = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + DonateUrl = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterLists", x => x.Id); + table.ForeignKey( + name: "FK_FilterLists_Licenses_LicenseId", + column: x => x.LicenseId, + principalTable: "Licenses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "SoftwareSyntax", + columns: table => new + { + SoftwareId = table.Column(type: "smallint", nullable: false), + SyntaxId = table.Column(type: "smallint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SoftwareSyntax", x => new { x.SoftwareId, x.SyntaxId }); + table.ForeignKey( + name: "FK_SoftwareSyntax_Software_SoftwareId", + column: x => x.SoftwareId, + principalTable: "Software", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SoftwareSyntax_Syntaxes_SyntaxId", + column: x => x.SyntaxId, + principalTable: "Syntaxes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Dependent", + columns: table => new + { + DependencyFilterListId = table.Column(type: "int", nullable: false), + DependentFilterListId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Dependent", x => new { x.DependencyFilterListId, x.DependentFilterListId }); + table.ForeignKey( + name: "FK_Dependent_FilterLists_DependencyFilterListId", + column: x => x.DependencyFilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Dependent_FilterLists_DependentFilterListId", + column: x => x.DependentFilterListId, + principalTable: "FilterLists", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "FilterListLanguage", + columns: table => new + { + FilterListId = table.Column(type: "int", nullable: false), + LanguageId = table.Column(type: "smallint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterListLanguage", x => new { x.FilterListId, x.LanguageId }); + table.ForeignKey( + name: "FK_FilterListLanguage_FilterLists_FilterListId", + column: x => x.FilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FilterListLanguage_Languages_LanguageId", + column: x => x.LanguageId, + principalTable: "Languages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FilterListMaintainer", + columns: table => new + { + FilterListId = table.Column(type: "int", nullable: false), + MaintainerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterListMaintainer", x => new { x.FilterListId, x.MaintainerId }); + table.ForeignKey( + name: "FK_FilterListMaintainer_FilterLists_FilterListId", + column: x => x.FilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FilterListMaintainer_Maintainers_MaintainerId", + column: x => x.MaintainerId, + principalTable: "Maintainers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FilterListSyntax", + columns: table => new + { + FilterListId = table.Column(type: "int", nullable: false), + SyntaxId = table.Column(type: "smallint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterListSyntax", x => new { x.FilterListId, x.SyntaxId }); + table.ForeignKey( + name: "FK_FilterListSyntax_FilterLists_FilterListId", + column: x => x.FilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FilterListSyntax_Syntaxes_SyntaxId", + column: x => x.SyntaxId, + principalTable: "Syntaxes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FilterListTag", + columns: table => new + { + FilterListId = table.Column(type: "int", nullable: false), + TagId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterListTag", x => new { x.FilterListId, x.TagId }); + table.ForeignKey( + name: "FK_FilterListTag_FilterLists_FilterListId", + column: x => x.FilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FilterListTag_Tags_TagId", + column: x => x.TagId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FilterListViewUrl", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FilterListId = table.Column(type: "int", nullable: false), + SegmentNumber = table.Column(type: "smallint", nullable: false, defaultValue: (short)1), + Primariness = table.Column(type: "smallint", nullable: false, defaultValue: (short)1), + Url = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterListViewUrl", x => new { x.FilterListId, x.Id }); + table.ForeignKey( + name: "FK_FilterListViewUrl_FilterLists_FilterListId", + column: x => x.FilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Fork", + columns: table => new + { + UpstreamFilterListId = table.Column(type: "int", nullable: false), + ForkFilterListId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Fork", x => new { x.UpstreamFilterListId, x.ForkFilterListId }); + table.ForeignKey( + name: "FK_Fork_FilterLists_ForkFilterListId", + column: x => x.ForkFilterListId, + principalTable: "FilterLists", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Fork_FilterLists_UpstreamFilterListId", + column: x => x.UpstreamFilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Merge", + columns: table => new + { + IncludedInFilterListId = table.Column(type: "int", nullable: false), + IncludesFilterListId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Merge", x => new { x.IncludedInFilterListId, x.IncludesFilterListId }); + table.ForeignKey( + name: "FK_Merge_FilterLists_IncludedInFilterListId", + column: x => x.IncludedInFilterListId, + principalTable: "FilterLists", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Merge_FilterLists_IncludesFilterListId", + column: x => x.IncludesFilterListId, + principalTable: "FilterLists", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Dependent_DependentFilterListId", + table: "Dependent", + column: "DependentFilterListId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterListLanguage_LanguageId", + table: "FilterListLanguage", + column: "LanguageId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterListMaintainer_MaintainerId", + table: "FilterListMaintainer", + column: "MaintainerId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterLists_LicenseId", + table: "FilterLists", + column: "LicenseId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterLists_Name", + table: "FilterLists", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_FilterListSyntax_SyntaxId", + table: "FilterListSyntax", + column: "SyntaxId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterListTag_TagId", + table: "FilterListTag", + column: "TagId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterListViewUrl_FilterListId_SegmentNumber_Primariness", + table: "FilterListViewUrl", + columns: new[] { "FilterListId", "SegmentNumber", "Primariness" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Fork_ForkFilterListId", + table: "Fork", + column: "ForkFilterListId"); + + migrationBuilder.CreateIndex( + name: "IX_Languages_Iso6391", + table: "Languages", + column: "Iso6391", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Languages_Name", + table: "Languages", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Licenses_Name", + table: "Licenses", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Maintainers_Name", + table: "Maintainers", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Merge_IncludesFilterListId", + table: "Merge", + column: "IncludesFilterListId"); + + migrationBuilder.CreateIndex( + name: "IX_Software_Name", + table: "Software", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_SoftwareSyntax_SyntaxId", + table: "SoftwareSyntax", + column: "SyntaxId"); + + migrationBuilder.CreateIndex( + name: "IX_Syntaxes_Name", + table: "Syntaxes", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Tags_Name", + table: "Tags", + column: "Name", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Dependent"); + + migrationBuilder.DropTable( + name: "FilterListLanguage"); + + migrationBuilder.DropTable( + name: "FilterListMaintainer"); + + migrationBuilder.DropTable( + name: "FilterListSyntax"); + + migrationBuilder.DropTable( + name: "FilterListTag"); + + migrationBuilder.DropTable( + name: "FilterListViewUrl"); + + migrationBuilder.DropTable( + name: "Fork"); + + migrationBuilder.DropTable( + name: "Merge"); + + migrationBuilder.DropTable( + name: "SoftwareSyntax"); + + migrationBuilder.DropTable( + name: "Languages"); + + migrationBuilder.DropTable( + name: "Maintainers"); + + migrationBuilder.DropTable( + name: "Tags"); + + migrationBuilder.DropTable( + name: "FilterLists"); + + migrationBuilder.DropTable( + name: "Software"); + + migrationBuilder.DropTable( + name: "Syntaxes"); + + migrationBuilder.DropTable( + name: "Licenses"); + } + } +} diff --git a/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/QueryDbContextModelSnapshot.cs b/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/QueryDbContextModelSnapshot.cs new file mode 100644 index 000000000..ddef76a97 --- /dev/null +++ b/services/Directory/FilterLists.Directory.Infrastructure.Migrations/Migrations/QueryDbContextModelSnapshot.cs @@ -0,0 +1,665 @@ +// +using FilterLists.Directory.Infrastructure.Persistence.Queries.Context; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FilterLists.Directory.Infrastructure.Migrations.Migrations +{ + [DbContext(typeof(QueryDbContext))] + partial class QueryDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Latin1_General_100_CI_AS_SC") + .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b => + { + b.Property("DependencyFilterListId") + .HasColumnType("int"); + + b.Property("DependentFilterListId") + .HasColumnType("int"); + + b.HasKey("DependencyFilterListId", "DependentFilterListId"); + + b.HasIndex("DependentFilterListId"); + + b.ToTable("Dependent"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ChatUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DonateUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("EmailAddress") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ForumUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("HomeUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("IssuesUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("LicenseId") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(5); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("OnionUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("PolicyUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("SubmissionUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("LicenseId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("FilterLists"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListLanguage", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("LanguageId") + .HasColumnType("smallint"); + + b.HasKey("FilterListId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("FilterListLanguage"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListMaintainer", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("MaintainerId") + .HasColumnType("int"); + + b.HasKey("FilterListId", "MaintainerId"); + + b.HasIndex("MaintainerId"); + + b.ToTable("FilterListMaintainer"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListSyntax", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("SyntaxId") + .HasColumnType("smallint"); + + b.HasKey("FilterListId", "SyntaxId"); + + b.HasIndex("SyntaxId"); + + b.ToTable("FilterListSyntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListTag", b => + { + b.Property("FilterListId") + .HasColumnType("int"); + + b.Property("TagId") + .HasColumnType("int"); + + b.HasKey("FilterListId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("FilterListTag"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Fork", b => + { + b.Property("UpstreamFilterListId") + .HasColumnType("int"); + + b.Property("ForkFilterListId") + .HasColumnType("int"); + + b.HasKey("UpstreamFilterListId", "ForkFilterListId"); + + b.HasIndex("ForkFilterListId"); + + b.ToTable("Fork"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Iso6391") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("nchar(2)") + .IsFixedLength(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Iso6391") + .IsUnique(); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Languages"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PermitsCommercialUse") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("PermitsDistribution") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("PermitsModification") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Licenses"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EmailAddress") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TwitterHandle") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Maintainers"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Merge", b => + { + b.Property("IncludedInFilterListId") + .HasColumnType("int"); + + b.Property("IncludesFilterListId") + .HasColumnType("int"); + + b.HasKey("IncludedInFilterListId", "IncludesFilterListId"); + + b.HasIndex("IncludesFilterListId"); + + b.ToTable("Merge"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DownloadUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("HomeUrl") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SupportsAbpUrlScheme") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Software"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SoftwareSyntax", b => + { + b.Property("SoftwareId") + .HasColumnType("smallint"); + + b.Property("SyntaxId") + .HasColumnType("smallint"); + + b.HasKey("SoftwareId", "SyntaxId"); + + b.HasIndex("SyntaxId"); + + b.ToTable("SoftwareSyntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Syntaxes"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependencyFilterList") + .WithMany("DependentFilterLists") + .HasForeignKey("DependencyFilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependentFilterList") + .WithMany("DependencyFilterLists") + .HasForeignKey("DependentFilterListId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("DependencyFilterList"); + + b.Navigation("DependentFilterList"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", "License") + .WithMany("FilterLists") + .HasForeignKey("LicenseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListViewUrl", "ViewUrls", b1 => + { + b1.Property("FilterListId") + .HasColumnType("int"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Primariness") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)1); + + b1.Property("SegmentNumber") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)1); + + b1.Property("Url") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b1.HasKey("FilterListId", "Id"); + + b1.HasIndex("FilterListId", "SegmentNumber", "Primariness") + .IsUnique(); + + b1.ToTable("FilterListViewUrl"); + + b1.WithOwner("FilterList") + .HasForeignKey("FilterListId"); + + b1.Navigation("FilterList"); + }); + + b.Navigation("License"); + + b.Navigation("ViewUrls"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListLanguage", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListLanguages") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", "Language") + .WithMany("FilterListLanguages") + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListMaintainer", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListMaintainers") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", "Maintainer") + .WithMany("FilterListMaintainers") + .HasForeignKey("MaintainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Maintainer"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListSyntax", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListSyntaxes") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", "Syntax") + .WithMany("FilterListSyntaxes") + .HasForeignKey("SyntaxId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Syntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterListTag", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "FilterList") + .WithMany("FilterListTags") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", "Tag") + .WithMany("FilterListTags") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterList"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Fork", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "ForkFilterList") + .WithMany("UpstreamFilterLists") + .HasForeignKey("ForkFilterListId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "UpstreamFilterList") + .WithMany("ForkFilterLists") + .HasForeignKey("UpstreamFilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ForkFilterList"); + + b.Navigation("UpstreamFilterList"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Merge", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "IncludedInFilterList") + .WithMany("IncludesFilterLists") + .HasForeignKey("IncludedInFilterListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "IncludesFilterList") + .WithMany("IncludedInFilterLists") + .HasForeignKey("IncludesFilterListId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("IncludedInFilterList"); + + b.Navigation("IncludesFilterList"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.SoftwareSyntax", b => + { + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", "Software") + .WithMany("SoftwareSyntaxes") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", "Syntax") + .WithMany("SoftwareSyntaxes") + .HasForeignKey("SyntaxId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Software"); + + b.Navigation("Syntax"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b => + { + b.Navigation("DependencyFilterLists"); + + b.Navigation("DependentFilterLists"); + + b.Navigation("FilterListLanguages"); + + b.Navigation("FilterListMaintainers"); + + b.Navigation("FilterListSyntaxes"); + + b.Navigation("FilterListTags"); + + b.Navigation("ForkFilterLists"); + + b.Navigation("IncludedInFilterLists"); + + b.Navigation("IncludesFilterLists"); + + b.Navigation("UpstreamFilterLists"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", b => + { + b.Navigation("FilterListLanguages"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", b => + { + b.Navigation("FilterLists"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", b => + { + b.Navigation("FilterListMaintainers"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b => + { + b.Navigation("SoftwareSyntaxes"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", b => + { + b.Navigation("FilterListSyntaxes"); + + b.Navigation("SoftwareSyntaxes"); + }); + + modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", b => + { + b.Navigation("FilterListTags"); + }); +#pragma warning restore 612, 618 + } + } +}