diff --git a/src/FilterLists.Api/Migrations/20180203004321_InitialRecreate.Designer.cs b/src/FilterLists.Api/Migrations/20180203004321_InitialRecreate.Designer.cs
deleted file mode 100644
index a5e7b3b3b..000000000
--- a/src/FilterLists.Api/Migrations/20180203004321_InitialRecreate.Designer.cs
+++ /dev/null
@@ -1,502 +0,0 @@
-//
-using FilterLists.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage;
-using System;
-
-namespace FilterLists.Api.Migrations
-{
- [DbContext(typeof(FilterListsDbContext))]
- [Migration("20180203004321_InitialRecreate")]
- partial class InitialRecreate
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
- .HasAnnotation("ProductVersion", "2.0.1-rtm-125");
-
- modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Description")
- .HasColumnType("TEXT");
-
- b.Property("DescriptionSourceUrl")
- .HasColumnType("TEXT");
-
- b.Property("DiscontinuedDate");
-
- b.Property("DonateUrl")
- .HasColumnType("TEXT");
-
- b.Property("EmailAddress")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.Property("ForumUrl")
- .HasColumnType("TEXT");
-
- b.Property("HomeUrl")
- .HasColumnType("TEXT");
-
- b.Property("IssuesUrl")
- .HasColumnType("TEXT");
-
- b.Property("LicenseId");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.Property("PolicyUrl")
- .HasColumnType("TEXT");
-
- b.Property("SubmissionUrl")
- .HasColumnType("TEXT");
-
- b.Property("SyntaxId");
-
- b.Property("ViewUrl")
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.HasIndex("LicenseId");
-
- b.HasIndex("SyntaxId");
-
- b.ToTable("filterlists");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
- {
- b.Property("FilterListId");
-
- b.Property("LanguageId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("FilterListId", "LanguageId");
-
- b.HasIndex("LanguageId");
-
- b.ToTable("filterlists_languages");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
- {
- b.Property("FilterListId");
-
- b.Property("MaintainerId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("FilterListId", "MaintainerId");
-
- b.HasIndex("MaintainerId");
-
- b.ToTable("filterlists_maintainers");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListRule", b =>
- {
- b.Property("FilterListId");
-
- b.Property("RuleId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("FilterListId", "RuleId");
-
- b.HasIndex("RuleId");
-
- b.ToTable("filterlists_rules");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
- {
- b.Property("ForkFilterListId");
-
- b.Property("UpstreamFilterListId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("ForkFilterListId", "UpstreamFilterListId");
-
- b.HasIndex("UpstreamFilterListId");
-
- b.ToTable("forks");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
- {
- b.Property("MergeFilterListId");
-
- b.Property("UpstreamFilterListId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("MergeFilterListId", "UpstreamFilterListId");
-
- b.HasIndex("UpstreamFilterListId");
-
- b.ToTable("merges");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
- {
- b.Property("SoftwareId");
-
- b.Property("SyntaxId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("SoftwareId", "SyntaxId");
-
- b.HasIndex("SyntaxId");
-
- b.ToTable("software_syntaxes");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Language", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Iso6391")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(2)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6392")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6392B")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6392T")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6393")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("LocalName")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.HasKey("Id");
-
- b.ToTable("languages");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("DescriptionUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.Property("PermissiveAdaptation");
-
- b.Property("PermissiveCommercial");
-
- b.HasKey("Id");
-
- b.ToTable("licenses");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("EmailAddress")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.Property("HomeUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.Property("TwitterHandle")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.HasKey("Id");
-
- b.ToTable("maintainers");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("BIGINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Raw")
- .IsRequired()
- .HasColumnType("VARCHAR(8192)");
-
- b.HasKey("Id");
-
- b.ToTable("rules");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Scrape", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("FilterListId");
-
- b.HasKey("Id");
-
- b.HasIndex("FilterListId");
-
- b.ToTable("scrapes");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("DownloadUrl")
- .HasColumnType("TEXT");
-
- b.Property("HomeUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.HasKey("Id");
-
- b.ToTable("software");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("DefinitionUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.HasKey("Id");
-
- b.ToTable("syntaxes");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
- {
- b.HasOne("FilterLists.Data.Entities.License")
- .WithMany("FilterLists")
- .HasForeignKey("LicenseId");
-
- b.HasOne("FilterLists.Data.Entities.Syntax")
- .WithMany("FilterLists")
- .HasForeignKey("SyntaxId");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
- .WithMany("FilterListLanguages")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Language", "Language")
- .WithMany("FilterListLanguages")
- .HasForeignKey("LanguageId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
- .WithMany("FilterListMaintainers")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Maintainer", "Maintainer")
- .WithMany("FilterListMaintainers")
- .HasForeignKey("MaintainerId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListRule", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
- .WithMany("FilterListRules")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Rule", "Rule")
- .WithMany("FilterListRules")
- .HasForeignKey("RuleId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "ForkFilterList")
- .WithMany("ForkFilterLists")
- .HasForeignKey("ForkFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList")
- .WithMany("UpstreamForkFilterLists")
- .HasForeignKey("UpstreamFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "MergeFilterList")
- .WithMany("MergeFilterLists")
- .HasForeignKey("MergeFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList")
- .WithMany("UpstreamMergeFilterLists")
- .HasForeignKey("UpstreamFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
- {
- b.HasOne("FilterLists.Data.Entities.Software", "Software")
- .WithMany("SoftwareSyntaxes")
- .HasForeignKey("SoftwareId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax")
- .WithMany("SoftwareSyntaxes")
- .HasForeignKey("SyntaxId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Scrape", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList")
- .WithMany("Scrapes")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/FilterLists.Api/Migrations/20180203203947_AddSnapshot.cs b/src/FilterLists.Api/Migrations/20180203203947_AddSnapshot.cs
deleted file mode 100644
index 8fa55bdee..000000000
--- a/src/FilterLists.Api/Migrations/20180203203947_AddSnapshot.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using System;
-using System.Collections.Generic;
-
-namespace FilterLists.Api.Migrations
-{
- public partial class AddSnapshot : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "filterlists_rules");
-
- migrationBuilder.DropTable(
- name: "scrapes");
-
- migrationBuilder.CreateTable(
- name: "snapshots",
- columns: table => new
- {
- Id = table.Column(type: "MEDIUMINT UNSIGNED", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- FilterListId = table.Column(nullable: false),
- HttpStatusCode = table.Column(type: "SMALLINT UNSIGNED", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_snapshots", x => x.Id);
- table.ForeignKey(
- name: "FK_snapshots_filterlists_FilterListId",
- column: x => x.FilterListId,
- principalTable: "filterlists",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "snapshots_rules",
- columns: table => new
- {
- SnapshotId = table.Column(nullable: false),
- RuleId = table.Column(nullable: false),
- CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_snapshots_rules", x => new { x.SnapshotId, x.RuleId });
- table.ForeignKey(
- name: "FK_snapshots_rules_rules_RuleId",
- column: x => x.RuleId,
- principalTable: "rules",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_snapshots_rules_snapshots_SnapshotId",
- column: x => x.SnapshotId,
- principalTable: "snapshots",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_snapshots_FilterListId",
- table: "snapshots",
- column: "FilterListId");
-
- migrationBuilder.CreateIndex(
- name: "IX_snapshots_rules_RuleId",
- table: "snapshots_rules",
- column: "RuleId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "snapshots_rules");
-
- migrationBuilder.DropTable(
- name: "snapshots");
-
- migrationBuilder.CreateTable(
- name: "filterlists_rules",
- columns: table => new
- {
- FilterListId = table.Column(nullable: false),
- RuleId = table.Column(nullable: false),
- CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_filterlists_rules", x => new { x.FilterListId, x.RuleId });
- table.ForeignKey(
- name: "FK_filterlists_rules_filterlists_FilterListId",
- column: x => x.FilterListId,
- principalTable: "filterlists",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_filterlists_rules_rules_RuleId",
- column: x => x.RuleId,
- principalTable: "rules",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "scrapes",
- columns: table => new
- {
- Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- FilterListId = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_scrapes", x => x.Id);
- table.ForeignKey(
- name: "FK_scrapes_filterlists_FilterListId",
- column: x => x.FilterListId,
- principalTable: "filterlists",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_filterlists_rules_RuleId",
- table: "filterlists_rules",
- column: "RuleId");
-
- migrationBuilder.CreateIndex(
- name: "IX_scrapes_FilterListId",
- table: "scrapes",
- column: "FilterListId");
- }
- }
-}
diff --git a/src/FilterLists.Api/Migrations/20180206161803_AddJunctionCompositeIndices.Designer.cs b/src/FilterLists.Api/Migrations/20180206161803_AddJunctionCompositeIndices.Designer.cs
deleted file mode 100644
index 3eb120b1e..000000000
--- a/src/FilterLists.Api/Migrations/20180206161803_AddJunctionCompositeIndices.Designer.cs
+++ /dev/null
@@ -1,523 +0,0 @@
-//
-using FilterLists.Data;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage;
-using System;
-
-namespace FilterLists.Api.Migrations
-{
- [DbContext(typeof(FilterListsDbContext))]
- [Migration("20180206161803_AddJunctionCompositeIndices")]
- partial class AddJunctionCompositeIndices
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
- .HasAnnotation("ProductVersion", "2.0.1-rtm-125");
-
- modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Description")
- .HasColumnType("TEXT");
-
- b.Property("DescriptionSourceUrl")
- .HasColumnType("TEXT");
-
- b.Property("DiscontinuedDate");
-
- b.Property("DonateUrl")
- .HasColumnType("TEXT");
-
- b.Property("EmailAddress")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.Property("ForumUrl")
- .HasColumnType("TEXT");
-
- b.Property("HomeUrl")
- .HasColumnType("TEXT");
-
- b.Property("IssuesUrl")
- .HasColumnType("TEXT");
-
- b.Property("LicenseId");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.Property("PolicyUrl")
- .HasColumnType("TEXT");
-
- b.Property("SubmissionUrl")
- .HasColumnType("TEXT");
-
- b.Property("SyntaxId");
-
- b.Property("ViewUrl")
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.HasIndex("LicenseId");
-
- b.HasIndex("SyntaxId");
-
- b.ToTable("filterlists");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
- {
- b.Property("FilterListId");
-
- b.Property("LanguageId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("FilterListId", "LanguageId");
-
- b.HasIndex("LanguageId");
-
- b.HasIndex("FilterListId", "LanguageId")
- .IsUnique();
-
- b.ToTable("filterlists_languages");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
- {
- b.Property("FilterListId");
-
- b.Property("MaintainerId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("FilterListId", "MaintainerId");
-
- b.HasIndex("MaintainerId");
-
- b.HasIndex("FilterListId", "MaintainerId")
- .IsUnique();
-
- b.ToTable("filterlists_maintainers");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
- {
- b.Property("ForkFilterListId");
-
- b.Property("UpstreamFilterListId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("ForkFilterListId", "UpstreamFilterListId");
-
- b.HasIndex("UpstreamFilterListId");
-
- b.HasIndex("ForkFilterListId", "UpstreamFilterListId")
- .IsUnique();
-
- b.ToTable("forks");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
- {
- b.Property("MergeFilterListId");
-
- b.Property("UpstreamFilterListId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("MergeFilterListId", "UpstreamFilterListId");
-
- b.HasIndex("UpstreamFilterListId");
-
- b.HasIndex("MergeFilterListId", "UpstreamFilterListId")
- .IsUnique();
-
- b.ToTable("merges");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SnapshotRule", b =>
- {
- b.Property("SnapshotId");
-
- b.Property("RuleId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("SnapshotId", "RuleId");
-
- b.HasIndex("RuleId");
-
- b.HasIndex("SnapshotId", "RuleId")
- .IsUnique();
-
- b.ToTable("snapshots_rules");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
- {
- b.Property("SoftwareId");
-
- b.Property("SyntaxId");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.HasKey("SoftwareId", "SyntaxId");
-
- b.HasIndex("SyntaxId");
-
- b.HasIndex("SoftwareId", "SyntaxId")
- .IsUnique();
-
- b.ToTable("software_syntaxes");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Language", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Iso6391")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(2)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6392")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6392B")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6392T")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("Iso6393")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(3)")
- .HasDefaultValueSql("NULL");
-
- b.Property("LocalName")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.HasKey("Id");
-
- b.ToTable("languages");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("DescriptionUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.Property("PermissiveAdaptation");
-
- b.Property("PermissiveCommercial");
-
- b.HasKey("Id");
-
- b.ToTable("licenses");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("EmailAddress")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.Property("HomeUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.Property("TwitterHandle")
- .ValueGeneratedOnAdd()
- .HasColumnType("VARCHAR(126)")
- .HasDefaultValueSql("NULL");
-
- b.HasKey("Id");
-
- b.ToTable("maintainers");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("BIGINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Raw")
- .IsRequired()
- .HasColumnType("VARCHAR(8192)");
-
- b.HasKey("Id");
-
- b.ToTable("rules");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("MEDIUMINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("FilterListId");
-
- b.Property("HttpStatusCode")
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.HasKey("Id");
-
- b.HasIndex("FilterListId");
-
- b.ToTable("snapshots");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("DownloadUrl")
- .HasColumnType("TEXT");
-
- b.Property("HomeUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.HasKey("Id");
-
- b.ToTable("software");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("SMALLINT UNSIGNED");
-
- b.Property("CreatedDateUtc")
- .ValueGeneratedOnAdd()
- .HasColumnType("TIMESTAMP");
-
- b.Property("DefinitionUrl")
- .HasColumnType("TEXT");
-
- b.Property("ModifiedDateUtc")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("TIMESTAMP");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("VARCHAR(126)");
-
- b.HasKey("Id");
-
- b.ToTable("syntaxes");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
- {
- b.HasOne("FilterLists.Data.Entities.License", "License")
- .WithMany("FilterLists")
- .HasForeignKey("LicenseId");
-
- b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax")
- .WithMany("FilterLists")
- .HasForeignKey("SyntaxId");
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
- .WithMany("FilterListLanguages")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Language", "Language")
- .WithMany("FilterListLanguages")
- .HasForeignKey("LanguageId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
- .WithMany("FilterListMaintainers")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Maintainer", "Maintainer")
- .WithMany("FilterListMaintainers")
- .HasForeignKey("MaintainerId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "ForkFilterList")
- .WithMany("ForkFilterLists")
- .HasForeignKey("ForkFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList")
- .WithMany("UpstreamForkFilterLists")
- .HasForeignKey("UpstreamFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "MergeFilterList")
- .WithMany("MergeFilterLists")
- .HasForeignKey("MergeFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList")
- .WithMany("UpstreamMergeFilterLists")
- .HasForeignKey("UpstreamFilterListId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SnapshotRule", b =>
- {
- b.HasOne("FilterLists.Data.Entities.Rule", "Rule")
- .WithMany("SnapshotRules")
- .HasForeignKey("RuleId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Snapshot", "Snapshot")
- .WithMany("SnapshotRules")
- .HasForeignKey("SnapshotId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
- {
- b.HasOne("FilterLists.Data.Entities.Software", "Software")
- .WithMany("SoftwareSyntaxes")
- .HasForeignKey("SoftwareId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax")
- .WithMany("SoftwareSyntaxes")
- .HasForeignKey("SyntaxId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b =>
- {
- b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
- .WithMany("Snapshots")
- .HasForeignKey("FilterListId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/FilterLists.Api/Migrations/20180206161803_AddJunctionCompositeIndices.cs b/src/FilterLists.Api/Migrations/20180206161803_AddJunctionCompositeIndices.cs
deleted file mode 100644
index 165df754b..000000000
--- a/src/FilterLists.Api/Migrations/20180206161803_AddJunctionCompositeIndices.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-using System;
-using System.Collections.Generic;
-
-namespace FilterLists.Api.Migrations
-{
- public partial class AddJunctionCompositeIndices : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateIndex(
- name: "IX_software_syntaxes_SoftwareId_SyntaxId",
- table: "software_syntaxes",
- columns: new[] { "SoftwareId", "SyntaxId" },
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_snapshots_rules_SnapshotId_RuleId",
- table: "snapshots_rules",
- columns: new[] { "SnapshotId", "RuleId" },
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_merges_MergeFilterListId_UpstreamFilterListId",
- table: "merges",
- columns: new[] { "MergeFilterListId", "UpstreamFilterListId" },
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_forks_ForkFilterListId_UpstreamFilterListId",
- table: "forks",
- columns: new[] { "ForkFilterListId", "UpstreamFilterListId" },
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_filterlists_maintainers_FilterListId_MaintainerId",
- table: "filterlists_maintainers",
- columns: new[] { "FilterListId", "MaintainerId" },
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_filterlists_languages_FilterListId_LanguageId",
- table: "filterlists_languages",
- columns: new[] { "FilterListId", "LanguageId" },
- unique: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_software_syntaxes_SoftwareId_SyntaxId",
- table: "software_syntaxes");
-
- migrationBuilder.DropIndex(
- name: "IX_snapshots_rules_SnapshotId_RuleId",
- table: "snapshots_rules");
-
- migrationBuilder.DropIndex(
- name: "IX_merges_MergeFilterListId_UpstreamFilterListId",
- table: "merges");
-
- migrationBuilder.DropIndex(
- name: "IX_forks_ForkFilterListId_UpstreamFilterListId",
- table: "forks");
-
- migrationBuilder.DropIndex(
- name: "IX_filterlists_maintainers_FilterListId_MaintainerId",
- table: "filterlists_maintainers");
-
- migrationBuilder.DropIndex(
- name: "IX_filterlists_languages_FilterListId_LanguageId",
- table: "filterlists_languages");
- }
- }
-}
diff --git a/src/FilterLists.Api/Migrations/20180203203947_AddSnapshot.Designer.cs b/src/FilterLists.Api/Migrations/20180206183743_InitialReCreate.Designer.cs
similarity index 96%
rename from src/FilterLists.Api/Migrations/20180203203947_AddSnapshot.Designer.cs
rename to src/FilterLists.Api/Migrations/20180206183743_InitialReCreate.Designer.cs
index 798a93ce5..be6929ef5 100644
--- a/src/FilterLists.Api/Migrations/20180203203947_AddSnapshot.Designer.cs
+++ b/src/FilterLists.Api/Migrations/20180206183743_InitialReCreate.Designer.cs
@@ -10,8 +10,8 @@
namespace FilterLists.Api.Migrations
{
[DbContext(typeof(FilterListsDbContext))]
- [Migration("20180203203947_AddSnapshot")]
- partial class AddSnapshot
+ [Migration("20180206183743_InitialReCreate")]
+ partial class InitialReCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@@ -97,7 +97,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("FilterListId", "LanguageId");
- b.HasIndex("LanguageId");
+ b.HasIndex("LanguageId", "FilterListId")
+ .IsUnique();
b.ToTable("filterlists_languages");
});
@@ -114,7 +115,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("FilterListId", "MaintainerId");
- b.HasIndex("MaintainerId");
+ b.HasIndex("MaintainerId", "FilterListId")
+ .IsUnique();
b.ToTable("filterlists_maintainers");
});
@@ -131,7 +133,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("ForkFilterListId", "UpstreamFilterListId");
- b.HasIndex("UpstreamFilterListId");
+ b.HasIndex("UpstreamFilterListId", "ForkFilterListId")
+ .IsUnique();
b.ToTable("forks");
});
@@ -148,7 +151,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("MergeFilterListId", "UpstreamFilterListId");
- b.HasIndex("UpstreamFilterListId");
+ b.HasIndex("UpstreamFilterListId", "MergeFilterListId")
+ .IsUnique();
b.ToTable("merges");
});
@@ -165,7 +169,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("SnapshotId", "RuleId");
- b.HasIndex("RuleId");
+ b.HasIndex("RuleId", "SnapshotId")
+ .IsUnique();
b.ToTable("snapshots_rules");
});
@@ -182,7 +187,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder)
b.HasKey("SoftwareId", "SyntaxId");
- b.HasIndex("SyntaxId");
+ b.HasIndex("SyntaxId", "SoftwareId")
+ .IsUnique();
b.ToTable("software_syntaxes");
});
diff --git a/src/FilterLists.Api/Migrations/20180203004321_InitialRecreate.cs b/src/FilterLists.Api/Migrations/20180206183743_InitialReCreate.cs
similarity index 90%
rename from src/FilterLists.Api/Migrations/20180203004321_InitialRecreate.cs
rename to src/FilterLists.Api/Migrations/20180206183743_InitialReCreate.cs
index 50a547a5d..805c631a9 100644
--- a/src/FilterLists.Api/Migrations/20180203004321_InitialRecreate.cs
+++ b/src/FilterLists.Api/Migrations/20180206183743_InitialReCreate.cs
@@ -5,7 +5,7 @@
namespace FilterLists.Api.Migrations
{
- public partial class InitialRecreate : Migration
+ public partial class InitialReCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -238,32 +238,6 @@ protected override void Up(MigrationBuilder migrationBuilder)
onDelete: ReferentialAction.Cascade);
});
- migrationBuilder.CreateTable(
- name: "filterlists_rules",
- columns: table => new
- {
- FilterListId = table.Column(nullable: false),
- RuleId = table.Column(nullable: false),
- CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_filterlists_rules", x => new { x.FilterListId, x.RuleId });
- table.ForeignKey(
- name: "FK_filterlists_rules_filterlists_FilterListId",
- column: x => x.FilterListId,
- principalTable: "filterlists",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_filterlists_rules_rules_RuleId",
- column: x => x.RuleId,
- principalTable: "rules",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
migrationBuilder.CreateTable(
name: "forks",
columns: table => new
@@ -317,26 +291,53 @@ protected override void Up(MigrationBuilder migrationBuilder)
});
migrationBuilder.CreateTable(
- name: "scrapes",
+ name: "snapshots",
columns: table => new
{
- Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false)
+ Id = table.Column(type: "MEDIUMINT UNSIGNED", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- FilterListId = table.Column(nullable: false)
+ FilterListId = table.Column(nullable: false),
+ HttpStatusCode = table.Column(type: "SMALLINT UNSIGNED", nullable: true)
},
constraints: table =>
{
- table.PrimaryKey("PK_scrapes", x => x.Id);
+ table.PrimaryKey("PK_snapshots", x => x.Id);
table.ForeignKey(
- name: "FK_scrapes_filterlists_FilterListId",
+ name: "FK_snapshots_filterlists_FilterListId",
column: x => x.FilterListId,
principalTable: "filterlists",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
+ migrationBuilder.CreateTable(
+ name: "snapshots_rules",
+ columns: table => new
+ {
+ SnapshotId = table.Column(nullable: false),
+ RuleId = table.Column(nullable: false),
+ CreatedDateUtc = table.Column(type: "TIMESTAMP", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_snapshots_rules", x => new { x.SnapshotId, x.RuleId });
+ table.ForeignKey(
+ name: "FK_snapshots_rules_rules_RuleId",
+ column: x => x.RuleId,
+ principalTable: "rules",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_snapshots_rules_snapshots_SnapshotId",
+ column: x => x.SnapshotId,
+ principalTable: "snapshots",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
migrationBuilder.CreateIndex(
name: "IX_filterlists_LicenseId",
table: "filterlists",
@@ -348,39 +349,45 @@ protected override void Up(MigrationBuilder migrationBuilder)
column: "SyntaxId");
migrationBuilder.CreateIndex(
- name: "IX_filterlists_languages_LanguageId",
+ name: "IX_filterlists_languages_LanguageId_FilterListId",
table: "filterlists_languages",
- column: "LanguageId");
+ columns: new[] { "LanguageId", "FilterListId" },
+ unique: true);
migrationBuilder.CreateIndex(
- name: "IX_filterlists_maintainers_MaintainerId",
+ name: "IX_filterlists_maintainers_MaintainerId_FilterListId",
table: "filterlists_maintainers",
- column: "MaintainerId");
+ columns: new[] { "MaintainerId", "FilterListId" },
+ unique: true);
migrationBuilder.CreateIndex(
- name: "IX_filterlists_rules_RuleId",
- table: "filterlists_rules",
- column: "RuleId");
-
- migrationBuilder.CreateIndex(
- name: "IX_forks_UpstreamFilterListId",
+ name: "IX_forks_UpstreamFilterListId_ForkFilterListId",
table: "forks",
- column: "UpstreamFilterListId");
+ columns: new[] { "UpstreamFilterListId", "ForkFilterListId" },
+ unique: true);
migrationBuilder.CreateIndex(
- name: "IX_merges_UpstreamFilterListId",
+ name: "IX_merges_UpstreamFilterListId_MergeFilterListId",
table: "merges",
- column: "UpstreamFilterListId");
+ columns: new[] { "UpstreamFilterListId", "MergeFilterListId" },
+ unique: true);
migrationBuilder.CreateIndex(
- name: "IX_scrapes_FilterListId",
- table: "scrapes",
+ name: "IX_snapshots_FilterListId",
+ table: "snapshots",
column: "FilterListId");
migrationBuilder.CreateIndex(
- name: "IX_software_syntaxes_SyntaxId",
+ name: "IX_snapshots_rules_RuleId_SnapshotId",
+ table: "snapshots_rules",
+ columns: new[] { "RuleId", "SnapshotId" },
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_software_syntaxes_SyntaxId_SoftwareId",
table: "software_syntaxes",
- column: "SyntaxId");
+ columns: new[] { "SyntaxId", "SoftwareId" },
+ unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
@@ -391,9 +398,6 @@ protected override void Down(MigrationBuilder migrationBuilder)
migrationBuilder.DropTable(
name: "filterlists_maintainers");
- migrationBuilder.DropTable(
- name: "filterlists_rules");
-
migrationBuilder.DropTable(
name: "forks");
@@ -401,7 +405,7 @@ protected override void Down(MigrationBuilder migrationBuilder)
name: "merges");
migrationBuilder.DropTable(
- name: "scrapes");
+ name: "snapshots_rules");
migrationBuilder.DropTable(
name: "software_syntaxes");
@@ -416,11 +420,14 @@ protected override void Down(MigrationBuilder migrationBuilder)
name: "rules");
migrationBuilder.DropTable(
- name: "filterlists");
+ name: "snapshots");
migrationBuilder.DropTable(
name: "software");
+ migrationBuilder.DropTable(
+ name: "filterlists");
+
migrationBuilder.DropTable(
name: "licenses");
diff --git a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs
index 0dd5a0113..97f003b82 100644
--- a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs
+++ b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs
@@ -96,9 +96,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasKey("FilterListId", "LanguageId");
- b.HasIndex("LanguageId");
-
- b.HasIndex("FilterListId", "LanguageId")
+ b.HasIndex("LanguageId", "FilterListId")
.IsUnique();
b.ToTable("filterlists_languages");
@@ -116,9 +114,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasKey("FilterListId", "MaintainerId");
- b.HasIndex("MaintainerId");
-
- b.HasIndex("FilterListId", "MaintainerId")
+ b.HasIndex("MaintainerId", "FilterListId")
.IsUnique();
b.ToTable("filterlists_maintainers");
@@ -136,9 +132,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasKey("ForkFilterListId", "UpstreamFilterListId");
- b.HasIndex("UpstreamFilterListId");
-
- b.HasIndex("ForkFilterListId", "UpstreamFilterListId")
+ b.HasIndex("UpstreamFilterListId", "ForkFilterListId")
.IsUnique();
b.ToTable("forks");
@@ -156,9 +150,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasKey("MergeFilterListId", "UpstreamFilterListId");
- b.HasIndex("UpstreamFilterListId");
-
- b.HasIndex("MergeFilterListId", "UpstreamFilterListId")
+ b.HasIndex("UpstreamFilterListId", "MergeFilterListId")
.IsUnique();
b.ToTable("merges");
@@ -176,9 +168,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasKey("SnapshotId", "RuleId");
- b.HasIndex("RuleId");
-
- b.HasIndex("SnapshotId", "RuleId")
+ b.HasIndex("RuleId", "SnapshotId")
.IsUnique();
b.ToTable("snapshots_rules");
@@ -196,9 +186,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasKey("SoftwareId", "SyntaxId");
- b.HasIndex("SyntaxId");
-
- b.HasIndex("SoftwareId", "SyntaxId")
+ b.HasIndex("SyntaxId", "SoftwareId")
.IsUnique();
b.ToTable("software_syntaxes");
diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs
index 1bd33ee7a..d79e07a53 100644
--- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs
+++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs
@@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder entityTypeB
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("filterlists_languages");
entityTypeBuilder.HasKey(x => new {x.FilterListId, x.LanguageId});
- entityTypeBuilder.HasIndex(x => new {x.FilterListId, x.LanguageId}).IsUnique();
+ entityTypeBuilder.HasIndex(x => new {x.LanguageId, x.FilterListId }).IsUnique();
entityTypeBuilder.HasOne(x => x.FilterList)
.WithMany(x => x.FilterListLanguages)
.HasForeignKey(x => x.FilterListId);
diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs
index 34d542be6..ea1e09867 100644
--- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs
+++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs
@@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder entityTyp
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("filterlists_maintainers");
entityTypeBuilder.HasKey(x => new {x.FilterListId, x.MaintainerId});
- entityTypeBuilder.HasIndex(x => new {x.FilterListId, x.MaintainerId}).IsUnique();
+ entityTypeBuilder.HasIndex(x => new {x.MaintainerId, x.FilterListId }).IsUnique();
entityTypeBuilder.HasOne(x => x.FilterList)
.WithMany(x => x.FilterListMaintainers)
.HasForeignKey(x => x.FilterListId);
diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs
index ee7d1567d..5c68e648f 100644
--- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs
+++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs
@@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder entityTypeBuilder)
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("forks");
entityTypeBuilder.HasKey(x => new {x.ForkFilterListId, x.UpstreamFilterListId});
- entityTypeBuilder.HasIndex(x => new {x.ForkFilterListId, x.UpstreamFilterListId}).IsUnique();
+ entityTypeBuilder.HasIndex(x => new {x.UpstreamFilterListId, x.ForkFilterListId }).IsUnique();
entityTypeBuilder.HasOne(x => x.ForkFilterList)
.WithMany(x => x.ForkFilterLists)
.HasForeignKey(x => x.ForkFilterListId);
diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs
index 6ed9159ab..46a1b2be8 100644
--- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs
+++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs
@@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder entityTypeBuilder)
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("merges");
entityTypeBuilder.HasKey(x => new {x.MergeFilterListId, x.UpstreamFilterListId});
- entityTypeBuilder.HasIndex(x => new {x.MergeFilterListId, x.UpstreamFilterListId}).IsUnique();
+ entityTypeBuilder.HasIndex(x => new {x.UpstreamFilterListId, x.MergeFilterListId }).IsUnique();
entityTypeBuilder.HasOne(x => x.MergeFilterList)
.WithMany(x => x.MergeFilterLists)
.HasForeignKey(x => x.MergeFilterListId);
diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SnapshotRuleTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SnapshotRuleTypeConfiguration.cs
index 38d4f821c..2e96390df 100644
--- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SnapshotRuleTypeConfiguration.cs
+++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SnapshotRuleTypeConfiguration.cs
@@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder entityTypeBuilder
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("snapshots_rules");
entityTypeBuilder.HasKey(x => new {x.SnapshotId, x.RuleId});
- entityTypeBuilder.HasIndex(x => new {x.SnapshotId, x.RuleId}).IsUnique();
+ entityTypeBuilder.HasIndex(x => new {x.RuleId, x.SnapshotId }).IsUnique();
entityTypeBuilder.HasOne(x => x.Snapshot)
.WithMany(x => x.SnapshotRules)
.HasForeignKey(x => x.SnapshotId);
diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs
index e5767193c..d0a3c0632 100644
--- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs
+++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs
@@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder entityTypeBuild
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("software_syntaxes");
entityTypeBuilder.HasKey(x => new {x.SoftwareId, x.SyntaxId});
- entityTypeBuilder.HasIndex(x => new {x.SoftwareId, x.SyntaxId}).IsUnique();
+ entityTypeBuilder.HasIndex(x => new {x.SyntaxId, x.SoftwareId }).IsUnique();
entityTypeBuilder.HasOne(x => x.Software)
.WithMany(x => x.SoftwareSyntaxes)
.HasForeignKey(x => x.SoftwareId);