Skip to content

Commit 8474f25

Browse files
authoredSep 23, 2021
Remove the release notes length limit (loic-sharma#687)
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
1 parent 2fdb83f commit 8474f25

13 files changed

+1095
-14
lines changed
 

‎src/BaGet.Core/Entities/AbstractContext.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ private void BuildPackageEntity(EntityTypeBuilder<Package> package)
6868
.HasMaxLength(MaxPackageVersionLength);
6969

7070
package.Property(p => p.ReleaseNotes)
71-
.HasColumnName("ReleaseNotes")
72-
.HasMaxLength(DefaultMaxStringLength);
71+
.HasColumnName("ReleaseNotes");
7372

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

‎src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.Designer.cs

+240
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using Microsoft.EntityFrameworkCore.Metadata;
3+
using Microsoft.EntityFrameworkCore.Migrations;
4+
5+
namespace BaGet.Database.MySql.Migrations
6+
{
7+
public partial class RemoveReleaseNotesMaxLength : Migration
8+
{
9+
protected override void Up(MigrationBuilder migrationBuilder)
10+
{
11+
migrationBuilder.AlterColumn<DateTime>(
12+
name: "RowVersion",
13+
table: "Packages",
14+
rowVersion: true,
15+
nullable: true,
16+
oldClrType: typeof(DateTime),
17+
oldType: "timestamp(6)",
18+
oldNullable: true)
19+
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
20+
}
21+
22+
protected override void Down(MigrationBuilder migrationBuilder)
23+
{
24+
migrationBuilder.AlterColumn<DateTime>(
25+
name: "RowVersion",
26+
table: "Packages",
27+
type: "timestamp(6)",
28+
nullable: true,
29+
oldClrType: typeof(DateTime),
30+
oldRowVersion: true,
31+
oldNullable: true)
32+
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
33+
}
34+
}
35+
}

‎src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1414
{
1515
#pragma warning disable 612, 618
1616
modelBuilder
17-
.HasAnnotation("ProductVersion", "3.1.1")
17+
.HasAnnotation("ProductVersion", "3.1.18")
1818
.HasAnnotation("Relational:MaxIdentifierLength", 64);
1919

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

8888
b.Property<string>("ReleaseNotes")
8989
.HasColumnName("ReleaseNotes")
90-
.HasColumnType("longtext CHARACTER SET utf8mb4")
91-
.HasMaxLength(4000);
90+
.HasColumnType("longtext CHARACTER SET utf8mb4");
9291

9392
b.Property<string>("RepositoryType")
9493
.HasColumnType("varchar(100) CHARACTER SET utf8mb4")

‎src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.Designer.cs

+247
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace BaGet.Database.PostgreSql.Migrations
4+
{
5+
public partial class RemoveReleaseNotesMaxLength : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
migrationBuilder.AlterColumn<string>(
10+
name: "ReleaseNotes",
11+
table: "Packages",
12+
nullable: true,
13+
oldClrType: typeof(string),
14+
oldType: "character varying(4000)",
15+
oldMaxLength: 4000,
16+
oldNullable: true);
17+
}
18+
19+
protected override void Down(MigrationBuilder migrationBuilder)
20+
{
21+
migrationBuilder.AlterColumn<string>(
22+
name: "ReleaseNotes",
23+
table: "Packages",
24+
type: "character varying(4000)",
25+
maxLength: 4000,
26+
nullable: true,
27+
oldClrType: typeof(string),
28+
oldNullable: true);
29+
}
30+
}
31+
}

‎src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1717
modelBuilder
1818
.HasAnnotation("Npgsql:PostgresExtension:citext", ",,")
1919
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
20-
.HasAnnotation("ProductVersion", "3.1.1")
20+
.HasAnnotation("ProductVersion", "3.1.18")
2121
.HasAnnotation("Relational:MaxIdentifierLength", 63);
2222

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

9292
b.Property<string>("ReleaseNotes")
9393
.HasColumnName("ReleaseNotes")
94-
.HasColumnType("character varying(4000)")
95-
.HasMaxLength(4000);
94+
.HasColumnType("text");
9695

9796
b.Property<string>("RepositoryType")
9897
.HasColumnType("character varying(100)")

‎src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.Designer.cs

+246
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace BaGet.Database.SqlServer.Migrations
4+
{
5+
public partial class RemoveReleaseNotesMaxLength : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
migrationBuilder.AlterColumn<string>(
10+
name: "ReleaseNotes",
11+
table: "Packages",
12+
nullable: true,
13+
oldClrType: typeof(string),
14+
oldType: "nvarchar(4000)",
15+
oldMaxLength: 4000,
16+
oldNullable: true);
17+
}
18+
19+
protected override void Down(MigrationBuilder migrationBuilder)
20+
{
21+
migrationBuilder.AlterColumn<string>(
22+
name: "ReleaseNotes",
23+
table: "Packages",
24+
type: "nvarchar(4000)",
25+
maxLength: 4000,
26+
nullable: true,
27+
oldClrType: typeof(string),
28+
oldNullable: true);
29+
}
30+
}
31+
}

‎src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1515
{
1616
#pragma warning disable 612, 618
1717
modelBuilder
18-
.HasAnnotation("ProductVersion", "3.1.1")
18+
.HasAnnotation("ProductVersion", "3.1.18")
1919
.HasAnnotation("Relational:MaxIdentifierLength", 128)
2020
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
2121

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

9191
b.Property<string>("ReleaseNotes")
9292
.HasColumnName("ReleaseNotes")
93-
.HasColumnType("nvarchar(4000)")
94-
.HasMaxLength(4000);
93+
.HasColumnType("nvarchar(max)");
9594

9695
b.Property<string>("RepositoryType")
9796
.HasColumnType("nvarchar(100)")

‎src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.Designer.cs

+239
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace BaGet.Database.Sqlite.Migrations
4+
{
5+
public partial class RemoveReleaseNotesMaxLength : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
10+
}
11+
12+
protected override void Down(MigrationBuilder migrationBuilder)
13+
{
14+
15+
}
16+
}
17+
}

‎src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1414
{
1515
#pragma warning disable 612, 618
1616
modelBuilder
17-
.HasAnnotation("ProductVersion", "3.1.1");
17+
.HasAnnotation("ProductVersion", "3.1.18");
1818

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

8787
b.Property<string>("ReleaseNotes")
8888
.HasColumnName("ReleaseNotes")
89-
.HasColumnType("TEXT")
90-
.HasMaxLength(4000);
89+
.HasColumnType("TEXT");
9190

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

0 commit comments

Comments
 (0)
Please sign in to comment.