Skip to content

Commit

Permalink
Remove the release notes length limit (#687)
Browse files Browse the repository at this point in the history
Kudos to @dncnkrs for the original implementation. 

This allows BaGet to index packages with large release notes, like https://www.nuget.org/packages/chocolatey/0.10.6.1
loic-sharma authored Sep 23, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 2fdb83f commit 8474f25
Showing 13 changed files with 1,095 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/BaGet.Core/Entities/AbstractContext.cs
Original file line number Diff line number Diff line change
@@ -68,8 +68,7 @@ private void BuildPackageEntity(EntityTypeBuilder<Package> package)
.HasMaxLength(MaxPackageVersionLength);

package.Property(p => p.ReleaseNotes)
.HasColumnName("ReleaseNotes")
.HasMaxLength(DefaultMaxStringLength);
.HasColumnName("ReleaseNotes");

package.Property(p => p.Authors)
.HasMaxLength(DefaultMaxStringLength)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace BaGet.Database.MySql.Migrations
{
public partial class RemoveReleaseNotesMaxLength : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "RowVersion",
table: "Packages",
rowVersion: true,
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp(6)",
oldNullable: true)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "RowVersion",
table: "Packages",
type: "timestamp(6)",
nullable: true,
oldClrType: typeof(DateTime),
oldRowVersion: true,
oldNullable: true)
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
}
}
}
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("ProductVersion", "3.1.18")
.HasAnnotation("Relational:MaxIdentifierLength", 64);

modelBuilder.Entity("BaGet.Core.Package", b =>
@@ -87,8 +87,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("ReleaseNotes")
.HasColumnName("ReleaseNotes")
.HasColumnType("longtext CHARACTER SET utf8mb4")
.HasMaxLength(4000);
.HasColumnType("longtext CHARACTER SET utf8mb4");

b.Property<string>("RepositoryType")
.HasColumnType("varchar(100) CHARACTER SET utf8mb4")
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace BaGet.Database.PostgreSql.Migrations
{
public partial class RemoveReleaseNotesMaxLength : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ReleaseNotes",
table: "Packages",
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(4000)",
oldMaxLength: 4000,
oldNullable: true);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ReleaseNotes",
table: "Packages",
type: "character varying(4000)",
maxLength: 4000,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
}
}
}
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder
.HasAnnotation("Npgsql:PostgresExtension:citext", ",,")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("ProductVersion", "3.1.18")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

modelBuilder.Entity("BaGet.Core.Package", b =>
@@ -91,8 +91,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("ReleaseNotes")
.HasColumnName("ReleaseNotes")
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
.HasColumnType("text");

b.Property<string>("RepositoryType")
.HasColumnType("character varying(100)")
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace BaGet.Database.SqlServer.Migrations
{
public partial class RemoveReleaseNotesMaxLength : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ReleaseNotes",
table: "Packages",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(4000)",
oldMaxLength: 4000,
oldNullable: true);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ReleaseNotes",
table: "Packages",
type: "nvarchar(4000)",
maxLength: 4000,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
}
}
}
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("ProductVersion", "3.1.18")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

@@ -90,8 +90,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("ReleaseNotes")
.HasColumnName("ReleaseNotes")
.HasColumnType("nvarchar(4000)")
.HasMaxLength(4000);
.HasColumnType("nvarchar(max)");

b.Property<string>("RepositoryType")
.HasColumnType("nvarchar(100)")
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace BaGet.Database.Sqlite.Migrations
{
public partial class RemoveReleaseNotesMaxLength : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{

}

protected override void Down(MigrationBuilder migrationBuilder)
{

}
}
}
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1");
.HasAnnotation("ProductVersion", "3.1.18");

modelBuilder.Entity("BaGet.Core.Package", b =>
{
@@ -86,8 +86,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("ReleaseNotes")
.HasColumnName("ReleaseNotes")
.HasColumnType("TEXT")
.HasMaxLength(4000);
.HasColumnType("TEXT");

b.Property<string>("RepositoryType")
.HasColumnType("TEXT")

0 comments on commit 8474f25

Please sign in to comment.