diff --git a/src/FilterLists.Api/Migrations/20180825124839_ExpandBatchSize.Designer.cs b/src/FilterLists.Api/Migrations/20180825124839_ExpandBatchSize.Designer.cs deleted file mode 100644 index 70ebb4565..000000000 --- a/src/FilterLists.Api/Migrations/20180825124839_ExpandBatchSize.Designer.cs +++ /dev/null @@ -1,650 +0,0 @@ -// - -using System; -using FilterLists.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FilterLists.Api.Migrations -{ - [DbContext(typeof(FilterListsDbContext))] - [Migration("20180825124839_ExpandBatchSize")] - partial class ExpandBatchSize - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.1.2-rtm-30932") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CantSnapshot"); - - b.Property("ChatUrl") - .HasColumnType("TEXT"); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("DescriptionSourceUrl") - .HasColumnType("TEXT"); - - b.Property("DiscontinuedDate") - .ValueGeneratedOnAdd() - .HasColumnType("DATE") - .HasDefaultValueSql("NULL"); - - 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") - .ValueGeneratedOnAdd() - .HasDefaultValue((byte)5); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()"); - - b.Property("Name") - .IsRequired() - .HasColumnType("VARCHAR(126)"); - - b.Property("PolicyUrl") - .HasColumnType("TEXT"); - - b.Property("PublishedDate") - .ValueGeneratedOnAdd() - .HasColumnType("DATE") - .HasDefaultValueSql("NULL"); - - 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") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_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") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.HasKey("FilterListId", "MaintainerId"); - - b.HasIndex("MaintainerId"); - - b.ToTable("filterlists_maintainers"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListTag", b => - { - b.Property("FilterListId"); - - b.Property("TagId"); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.HasKey("FilterListId", "TagId"); - - b.HasIndex("TagId"); - - b.ToTable("filterlists_tags"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b => - { - b.Property("ForkFilterListId"); - - b.Property("UpstreamFilterListId"); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_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") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.HasKey("MergeFilterListId", "UpstreamFilterListId"); - - b.HasIndex("UpstreamFilterListId"); - - b.ToTable("merges"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SnapshotRule", b => - { - b.Property("SnapshotId"); - - b.Property("RuleId"); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.HasKey("SnapshotId", "RuleId"); - - b.HasIndex("RuleId"); - - b.ToTable("snapshots_rules"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b => - { - b.Property("SyntaxId"); - - b.Property("SoftwareId"); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.HasKey("SyntaxId", "SoftwareId"); - - b.HasIndex("SoftwareId"); - - b.ToTable("software_syntaxes"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Language", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_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") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_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("TINYINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("DescriptionUrl") - .HasColumnType("TEXT"); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_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") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("EmailAddress") - .ValueGeneratedOnAdd() - .HasColumnType("VARCHAR(126)") - .HasDefaultValueSql("NULL"); - - b.Property("HomeUrl") - .HasColumnType("TEXT"); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_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("INT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("Raw") - .IsRequired() - .HasColumnType("LONGTEXT"); - - b.HasKey("Id"); - - b.ToTable("rules"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("MEDIUMINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("BatchSize") - .ValueGeneratedOnAdd() - .HasColumnType("MEDIUMINT UNSIGNED") - .HasDefaultValueSql("NULL"); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("FilterListId"); - - b.Property("HttpStatusCode") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT") - .HasDefaultValueSql("NULL"); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()"); - - b.Property("WasSuccessful"); - - b.Property("WaybackTimestamp") - .HasColumnType("TIMESTAMP"); - - b.HasKey("Id"); - - b.HasIndex("FilterListId"); - - b.ToTable("snapshots"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Software", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TINYINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("DownloadUrl") - .HasColumnType("TEXT"); - - b.Property("HomeUrl") - .HasColumnType("TEXT"); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_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("TINYINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("DefinitionUrl") - .HasColumnType("TEXT"); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()"); - - b.Property("Name") - .IsRequired() - .HasColumnType("VARCHAR(126)"); - - b.HasKey("Id"); - - b.ToTable("syntaxes"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.Tag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TINYINT UNSIGNED") - .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - b.Property("CreatedDateUtc") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp()"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDateUtc") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TIMESTAMP") - .HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()"); - - b.Property("Name") - .IsRequired() - .HasColumnType("VARCHAR(126)"); - - b.HasKey("Id"); - - b.ToTable("tags"); - }); - - modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b => - { - b.HasOne("FilterLists.Data.Entities.License", "License") - .WithMany("FilterLists") - .HasForeignKey("LicenseId") - .OnDelete(DeleteBehavior.Cascade); - - 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.FilterListTag", b => - { - b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList") - .WithMany("FilterListTags") - .HasForeignKey("FilterListId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("FilterLists.Data.Entities.Tag", "Tag") - .WithMany("FilterListTags") - .HasForeignKey("TagId") - .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 - } - } -} \ No newline at end of file diff --git a/src/FilterLists.Api/Migrations/20180825124839_ExpandBatchSize.cs b/src/FilterLists.Api/Migrations/20180825124839_ExpandBatchSize.cs deleted file mode 100644 index 748f2d617..000000000 --- a/src/FilterLists.Api/Migrations/20180825124839_ExpandBatchSize.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FilterLists.Api.Migrations -{ - public partial class ExpandBatchSize : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - "BatchSize", - "snapshots", - "MEDIUMINT UNSIGNED", - nullable: true, - defaultValueSql: "NULL", - oldClrType: typeof(short), - oldType: "SMALLINT", - oldNullable: true, - oldDefaultValueSql: "NULL"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - "BatchSize", - "snapshots", - "SMALLINT", - nullable: true, - defaultValueSql: "NULL", - oldClrType: typeof(uint), - oldType: "MEDIUMINT UNSIGNED", - oldNullable: true, - oldDefaultValueSql: "NULL"); - } - } -} \ No newline at end of file diff --git a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs index e04ffc9e2..11ddd4fa3 100644 --- a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs +++ b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs @@ -400,9 +400,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("MEDIUMINT UNSIGNED") .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - b.Property("BatchSize") + b.Property("BatchSize") .ValueGeneratedOnAdd() - .HasColumnType("MEDIUMINT UNSIGNED") + .HasColumnType("SMALLINT") .HasDefaultValueSql("NULL"); b.Property("CreatedDateUtc") diff --git a/src/FilterLists.Data/Entities/Snapshot.cs b/src/FilterLists.Data/Entities/Snapshot.cs index d3b1667e1..0d8882423 100644 --- a/src/FilterLists.Data/Entities/Snapshot.cs +++ b/src/FilterLists.Data/Entities/Snapshot.cs @@ -6,7 +6,7 @@ namespace FilterLists.Data.Entities { public class Snapshot : BaseEntity { - public uint? BatchSize { get; set; } + public int? BatchSize { get; set; } public uint FilterListId { get; set; } public FilterList FilterList { get; set; } public int? HttpStatusCode { get; set; } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/SnapshotTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/SnapshotTypeConfiguration.cs index 8783953aa..a58994fe5 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/SnapshotTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/SnapshotTypeConfiguration.cs @@ -13,7 +13,7 @@ public override void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("MEDIUMINT UNSIGNED"); entityTypeBuilder.Property(x => x.BatchSize) - .HasColumnType("MEDIUMINT UNSIGNED") + .HasColumnType("SMALLINT") .HasDefaultValueSql("NULL"); entityTypeBuilder.Property(x => x.HttpStatusCode) .HasColumnType("SMALLINT") diff --git a/src/FilterLists.Services/Snapshot/BatchSizeService.cs b/src/FilterLists.Services/Snapshot/BatchSizeService.cs index a10d170a1..985e44a39 100644 --- a/src/FilterLists.Services/Snapshot/BatchSizeService.cs +++ b/src/FilterLists.Services/Snapshot/BatchSizeService.cs @@ -16,13 +16,13 @@ public BatchSizeService(FilterListsDbContext dbContext) : base(dbContext) { } - public async Task GetBatchSize() + public async Task GetBatchSize() { var recentSnapPerfs = await GetRecentSnapPerfs(); return recentSnapPerfs.Count == 2 ? (recentSnapPerfs[0].RulesPerMs >= recentSnapPerfs[1].RulesPerMs - ? (uint)Math.Round(recentSnapPerfs[0].BatchSize * (1 + PercentMultiplier)) - : (uint)Math.Round(recentSnapPerfs[0].BatchSize * (1 - PercentMultiplier))) + ? (int)Math.Round(recentSnapPerfs[0].BatchSize * (1 + PercentMultiplier)) + : (int)Math.Round(recentSnapPerfs[0].BatchSize * (1 - PercentMultiplier))) : DefaultBatchSize; } @@ -42,7 +42,7 @@ await DbContext.Snapshots private class SnapshotPerformance { - public uint BatchSize { get; set; } + public int BatchSize { get; set; } public int RulesCount { private get; set; } public DateTime CreatedDateUtc { private get; set; } public DateTime ModifiedDateUtc { private get; set; } diff --git a/src/FilterLists.Services/Snapshot/Snapshot.cs b/src/FilterLists.Services/Snapshot/Snapshot.cs index 6a1bb0608..f681e6c2a 100644 --- a/src/FilterLists.Services/Snapshot/Snapshot.cs +++ b/src/FilterLists.Services/Snapshot/Snapshot.cs @@ -128,7 +128,7 @@ private async Task SaveInBatches() private async Task> CreateBatches() { SnapEntity.BatchSize = await batchSizeService.GetBatchSize(); - return lines.Batch((int)SnapEntity.BatchSize.Value).Select(b => new Batch(dbContext, b, SnapEntity)); + return lines.Batch(SnapEntity.BatchSize.Value).Select(b => new Batch(dbContext, b, SnapEntity)); } private static async Task SaveBatches(IEnumerable batches)