recreate junction indexes

https://stackoverflow.com/q/48645872/2343739
This commit is contained in:
Collin M. Barrett 2018-02-06 12:41:55 -06:00
parent f92c6c3b59
commit 5e5dcf35cc
13 changed files with 87 additions and 1329 deletions

View file

@ -1,502 +0,0 @@
// <auto-generated />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("DescriptionSourceUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("DiscontinuedDate");
b.Property<string>("DonateUrl")
.HasColumnType("TEXT");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<string>("ForumUrl")
.HasColumnType("TEXT");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<string>("IssuesUrl")
.HasColumnType("TEXT");
b.Property<int?>("LicenseId");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<string>("PolicyUrl")
.HasColumnType("TEXT");
b.Property<string>("SubmissionUrl")
.HasColumnType("TEXT");
b.Property<int?>("SyntaxId");
b.Property<string>("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<int>("FilterListId");
b.Property<int>("LanguageId");
b.Property<DateTime>("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<int>("FilterListId");
b.Property<int>("MaintainerId");
b.Property<DateTime>("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<int>("FilterListId");
b.Property<int>("RuleId");
b.Property<DateTime>("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<int>("ForkFilterListId");
b.Property<int>("UpstreamFilterListId");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.HasKey("ForkFilterListId", "UpstreamFilterListId");
b.HasIndex("UpstreamFilterListId");
b.ToTable("forks");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
{
b.Property<int>("MergeFilterListId");
b.Property<int>("UpstreamFilterListId");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.HasKey("MergeFilterListId", "UpstreamFilterListId");
b.HasIndex("UpstreamFilterListId");
b.ToTable("merges");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
{
b.Property<int>("SoftwareId");
b.Property<int>("SyntaxId");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.HasKey("SoftwareId", "SyntaxId");
b.HasIndex("SyntaxId");
b.ToTable("software_syntaxes");
});
modelBuilder.Entity("FilterLists.Data.Entities.Language", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("Iso6391")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(2)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392B")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392T")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6393")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("LocalName")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.HasKey("Id");
b.ToTable("languages");
});
modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("DescriptionUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<bool>("PermissiveAdaptation");
b.Property<bool>("PermissiveCommercial");
b.HasKey("Id");
b.ToTable("licenses");
});
modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<string>("TwitterHandle")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.HasKey("Id");
b.ToTable("maintainers");
});
modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("BIGINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("Raw")
.IsRequired()
.HasColumnType("VARCHAR(8192)");
b.HasKey("Id");
b.ToTable("rules");
});
modelBuilder.Entity("FilterLists.Data.Entities.Scrape", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<int>("FilterListId");
b.HasKey("Id");
b.HasIndex("FilterListId");
b.ToTable("scrapes");
});
modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("DownloadUrl")
.HasColumnType("TEXT");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.HasKey("Id");
b.ToTable("software");
});
modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("DefinitionUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("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
}
}
}

View file

@ -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<int>(type: "MEDIUMINT UNSIGNED", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreatedDateUtc = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
FilterListId = table.Column<int>(nullable: false),
HttpStatusCode = table.Column<int>(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<int>(nullable: false),
RuleId = table.Column<int>(nullable: false),
CreatedDateUtc = table.Column<DateTime>(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<int>(nullable: false),
RuleId = table.Column<int>(nullable: false),
CreatedDateUtc = table.Column<DateTime>(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<int>(type: "SMALLINT UNSIGNED", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreatedDateUtc = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
FilterListId = table.Column<int>(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");
}
}
}

View file

@ -1,523 +0,0 @@
// <auto-generated />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("DescriptionSourceUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("DiscontinuedDate");
b.Property<string>("DonateUrl")
.HasColumnType("TEXT");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<string>("ForumUrl")
.HasColumnType("TEXT");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<string>("IssuesUrl")
.HasColumnType("TEXT");
b.Property<int?>("LicenseId");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<string>("PolicyUrl")
.HasColumnType("TEXT");
b.Property<string>("SubmissionUrl")
.HasColumnType("TEXT");
b.Property<int?>("SyntaxId");
b.Property<string>("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<int>("FilterListId");
b.Property<int>("LanguageId");
b.Property<DateTime>("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<int>("FilterListId");
b.Property<int>("MaintainerId");
b.Property<DateTime>("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<int>("ForkFilterListId");
b.Property<int>("UpstreamFilterListId");
b.Property<DateTime>("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<int>("MergeFilterListId");
b.Property<int>("UpstreamFilterListId");
b.Property<DateTime>("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<int>("SnapshotId");
b.Property<int>("RuleId");
b.Property<DateTime>("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<int>("SoftwareId");
b.Property<int>("SyntaxId");
b.Property<DateTime>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("Iso6391")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(2)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392B")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392T")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6393")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("LocalName")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.HasKey("Id");
b.ToTable("languages");
});
modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("DescriptionUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<bool>("PermissiveAdaptation");
b.Property<bool>("PermissiveCommercial");
b.HasKey("Id");
b.ToTable("licenses");
});
modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<string>("TwitterHandle")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.HasKey("Id");
b.ToTable("maintainers");
});
modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("BIGINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("Raw")
.IsRequired()
.HasColumnType("VARCHAR(8192)");
b.HasKey("Id");
b.ToTable("rules");
});
modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("MEDIUMINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<int>("FilterListId");
b.Property<int?>("HttpStatusCode")
.HasColumnType("SMALLINT UNSIGNED");
b.HasKey("Id");
b.HasIndex("FilterListId");
b.ToTable("snapshots");
});
modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("DownloadUrl")
.HasColumnType("TEXT");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.HasKey("Id");
b.ToTable("software");
});
modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
b.Property<DateTime>("CreatedDateUtc")
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
b.Property<string>("DefinitionUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
b.Property<string>("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
}
}
}

View file

@ -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");
}
}
}

View file

@ -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");
});

View file

@ -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<int>(nullable: false),
RuleId = table.Column<int>(nullable: false),
CreatedDateUtc = table.Column<DateTime>(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<int>(type: "SMALLINT UNSIGNED", nullable: false)
Id = table.Column<int>(type: "MEDIUMINT UNSIGNED", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreatedDateUtc = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
FilterListId = table.Column<int>(nullable: false)
FilterListId = table.Column<int>(nullable: false),
HttpStatusCode = table.Column<int>(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<int>(nullable: false),
RuleId = table.Column<int>(nullable: false),
CreatedDateUtc = table.Column<DateTime>(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");

View file

@ -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");

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<FilterListLanguage> 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);

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<FilterListMaintainer> 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);

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<Fork> 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);

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<Merge> 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);

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<SnapshotRule> 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);

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<SoftwareSyntax> 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);