diff --git a/src/BaGet.Azure/Table/PackageEntity.cs b/src/BaGet.Azure/Table/PackageEntity.cs index 57fbb8a5..b3b133c9 100644 --- a/src/BaGet.Azure/Table/PackageEntity.cs +++ b/src/BaGet.Azure/Table/PackageEntity.cs @@ -29,6 +29,7 @@ public PackageEntity() public DateTime Published { get; set; } public bool RequireLicenseAcceptance { get; set; } public int SemVerLevel { get; set; } + public string ReleaseNotes { get; set; } public string Summary { get; set; } public string Title { get; set; } diff --git a/src/BaGet.Azure/Table/TableOperationBuilder.cs b/src/BaGet.Azure/Table/TableOperationBuilder.cs index 15e71ef2..dc4db2c2 100644 --- a/src/BaGet.Azure/Table/TableOperationBuilder.cs +++ b/src/BaGet.Azure/Table/TableOperationBuilder.cs @@ -40,6 +40,7 @@ public TableOperation AddPackage(Package package) Title = package.Title, IconUrl = package.IconUrlString, LicenseUrl = package.LicenseUrlString, + ReleaseNotes = package.ReleaseNotes, ProjectUrl = package.ProjectUrlString, RepositoryUrl = package.RepositoryUrlString, RepositoryType = package.RepositoryType, diff --git a/src/BaGet.Azure/Table/TablePackageService.cs b/src/BaGet.Azure/Table/TablePackageService.cs index 7483cce9..195e1499 100644 --- a/src/BaGet.Azure/Table/TablePackageService.cs +++ b/src/BaGet.Azure/Table/TablePackageService.cs @@ -239,6 +239,7 @@ private Package AsPackage(PackageEntity entity) SemVerLevel = (SemVerLevel)entity.SemVerLevel, Summary = entity.Summary, Title = entity.Title, + ReleaseNotes = entity.ReleaseNotes, IconUrl = ParseUri(entity.IconUrl), LicenseUrl = ParseUri(entity.LicenseUrl), ProjectUrl = ParseUri(entity.ProjectUrl), diff --git a/src/BaGet.Core/Entities/AbstractContext.cs b/src/BaGet.Core/Entities/AbstractContext.cs index 63f2618f..a2ec8d6e 100644 --- a/src/BaGet.Core/Entities/AbstractContext.cs +++ b/src/BaGet.Core/Entities/AbstractContext.cs @@ -63,6 +63,10 @@ private void BuildPackageEntity(EntityTypeBuilder package) .HasColumnName("OriginalVersion") .HasMaxLength(MaxPackageVersionLength); + package.Property(p => p.ReleaseNotes) + .HasColumnName("ReleaseNotes") + .HasMaxLength(DefaultMaxStringLength); + package.Property(p => p.Authors) .HasMaxLength(DefaultMaxStringLength) .HasConversion(StringArrayToJsonConverter.Instance) diff --git a/src/BaGet.Core/Entities/Package.cs b/src/BaGet.Core/Entities/Package.cs index 269bbeb6..d02f56f2 100644 --- a/src/BaGet.Core/Entities/Package.cs +++ b/src/BaGet.Core/Entities/Package.cs @@ -35,6 +35,7 @@ public NuGetVersion Version public long Downloads { get; set; } public bool HasReadme { get; set; } public bool IsPrerelease { get; set; } + public string ReleaseNotes { get; set; } public string Language { get; set; } public bool Listed { get; set; } public string MinClientVersion { get; set; } diff --git a/src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs b/src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs index cfdc5b74..0b7180a2 100644 --- a/src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs +++ b/src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs @@ -59,6 +59,7 @@ public static Package GetPackageMetadata(this PackageArchiveReader packageReader HasReadme = packageReader.HasReadme(), IsPrerelease = nuspec.GetVersion().IsPrerelease, Language = nuspec.GetLanguage() ?? string.Empty, + ReleaseNotes = nuspec.GetReleaseNotes() ?? string.Empty, Listed = true, MinClientVersion = nuspec.GetMinClientVersion()?.ToNormalizedString() ?? string.Empty, Published = DateTime.UtcNow, diff --git a/src/BaGet.Core/Metadata/BaGetPackageMetadata.cs b/src/BaGet.Core/Metadata/BaGetPackageMetadata.cs index 39bd40a2..f6dba1d6 100644 --- a/src/BaGet.Core/Metadata/BaGetPackageMetadata.cs +++ b/src/BaGet.Core/Metadata/BaGetPackageMetadata.cs @@ -19,10 +19,17 @@ public class BaGetPackageMetadata : PackageMetadata [JsonProperty("packageTypes")] public IReadOnlyList PackageTypes { get; set; } + /// + /// The package's release notes. + /// + [JsonProperty("releaseNotes")] + public string ReleaseNotes { get; set; } + [JsonProperty("repositoryUrl")] public string RepositoryUrl { get; set; } [JsonProperty("repositoryType")] public string RepositoryType { get; set; } + } } diff --git a/src/BaGet.Core/Metadata/RegistrationBuilder.cs b/src/BaGet.Core/Metadata/RegistrationBuilder.cs index be1cc368..b2a98d2c 100644 --- a/src/BaGet.Core/Metadata/RegistrationBuilder.cs +++ b/src/BaGet.Core/Metadata/RegistrationBuilder.cs @@ -76,6 +76,7 @@ private RegistrationIndexPageItem ToRegistrationIndexPageItem(Package package) = LicenseUrl = package.LicenseUrlString, Listed = package.Listed, MinClientVersion = package.MinClientVersion, + ReleaseNotes = package.ReleaseNotes, PackageContentUrl = _url.GetPackageDownloadUrl(package.Id, package.Version), PackageTypes = package.PackageTypes.Select(t => t.Name).ToList(), ProjectUrl = package.ProjectUrlString, diff --git a/src/BaGet.Database.MySql/Migrations/20200109085155_AddReleaseNotesStringColumn.Designer.cs b/src/BaGet.Database.MySql/Migrations/20200109085155_AddReleaseNotesStringColumn.Designer.cs new file mode 100644 index 00000000..64554a06 --- /dev/null +++ b/src/BaGet.Database.MySql/Migrations/20200109085155_AddReleaseNotesStringColumn.Designer.cs @@ -0,0 +1,199 @@ +// +using System; +using BaGet.Database.MySql; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace BaGet.Database.MySql.Migrations +{ + [DbContext(typeof(MySqlContext))] + [Migration("20200109085155_AddReleaseNotesStringColumn")] + partial class AddReleaseNotesStringColumn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Authors") + .HasMaxLength(4000); + + b.Property("Description") + .HasMaxLength(4000); + + b.Property("Downloads"); + + b.Property("HasReadme"); + + b.Property("IconUrl") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasMaxLength(128); + + b.Property("IsPrerelease"); + + b.Property("Language") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasMaxLength(4000); + + b.Property("Listed"); + + b.Property("MinClientVersion") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasMaxLength(4000); + + b.Property("Published"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + + b.Property("RepositoryType") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate(); + + b.Property("SemVerLevel"); + + b.Property("Summary") + .HasMaxLength(4000); + + b.Property("Tags") + .HasMaxLength(4000); + + b.Property("Title") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("Id", "NormalizedVersionString") + .IsUnique(); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Id") + .HasMaxLength(128); + + b.Property("PackageKey"); + + b.Property("TargetFramework") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasMaxLength(512); + + b.Property("PackageKey"); + + b.Property("Version") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Moniker") + .HasMaxLength(256); + + b.Property("PackageKey"); + + b.HasKey("Key"); + + b.HasIndex("Moniker"); + + b.HasIndex("PackageKey"); + + b.ToTable("TargetFrameworks"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("Dependencies") + .HasForeignKey("PackageKey"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("PackageTypes") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.MySql/Migrations/20200109085155_AddReleaseNotesStringColumn.cs b/src/BaGet.Database.MySql/Migrations/20200109085155_AddReleaseNotesStringColumn.cs new file mode 100644 index 00000000..e098cdf8 --- /dev/null +++ b/src/BaGet.Database.MySql/Migrations/20200109085155_AddReleaseNotesStringColumn.cs @@ -0,0 +1,40 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace BaGet.Database.MySql.Migrations +{ + public partial class AddReleaseNotesStringColumn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "RowVersion", + table: "Packages", + rowVersion: true, + nullable: true, + oldClrType: typeof(DateTime), + oldNullable: true); + + migrationBuilder.AddColumn( + name: "ReleaseNotes", + table: "Packages", + maxLength: 4000, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ReleaseNotes", + table: "Packages"); + + migrationBuilder.AlterColumn( + name: "RowVersion", + table: "Packages", + nullable: true, + oldClrType: typeof(DateTime), + oldRowVersion: true, + oldNullable: true); + } + } +} diff --git a/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs b/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs index 1e8e9c52..c3d15249 100644 --- a/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs +++ b/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") .HasAnnotation("Relational:MaxIdentifierLength", 64); - modelBuilder.Entity("BaGet.Core.Entities.Package", b => + modelBuilder.Entity("BaGet.Core.Package", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -66,6 +66,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Published"); + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + b.Property("RepositoryType") .HasMaxLength(100); @@ -99,7 +103,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Packages"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -124,7 +128,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageDependencies"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -146,7 +150,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageTypes"); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -165,24 +169,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("TargetFrameworks"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("Dependencies") .HasForeignKey("PackageKey"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("PackageTypes") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("TargetFrameworks") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/BaGet.Database.PostgreSql/Migrations/20200109085355_AddReleaseNotesStringColumn.Designer.cs b/src/BaGet.Database.PostgreSql/Migrations/20200109085355_AddReleaseNotesStringColumn.Designer.cs new file mode 100644 index 00000000..b3a6aacf --- /dev/null +++ b/src/BaGet.Database.PostgreSql/Migrations/20200109085355_AddReleaseNotesStringColumn.Designer.cs @@ -0,0 +1,206 @@ +// +using System; +using BaGet.Database.PostgreSql; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace BaGet.Database.PostgreSql.Migrations +{ + [DbContext(typeof(PostgreSqlContext))] + [Migration("20200109085355_AddReleaseNotesStringColumn")] + partial class AddReleaseNotesStringColumn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:PostgresExtension:citext", ",,") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Authors") + .HasMaxLength(4000); + + b.Property("Description") + .HasMaxLength(4000); + + b.Property("Downloads"); + + b.Property("HasReadme"); + + b.Property("IconUrl") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasColumnType("citext") + .HasMaxLength(128); + + b.Property("IsPrerelease"); + + b.Property("Language") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasMaxLength(4000); + + b.Property("Listed"); + + b.Property("MinClientVersion") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasMaxLength(4000); + + b.Property("Published"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + + b.Property("RepositoryType") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate(); + + b.Property("SemVerLevel"); + + b.Property("Summary") + .HasMaxLength(4000); + + b.Property("Tags") + .HasMaxLength(4000); + + b.Property("Title") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("Id", "NormalizedVersionString") + .IsUnique(); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Id") + .HasColumnType("citext") + .HasMaxLength(128); + + b.Property("PackageKey"); + + b.Property("TargetFramework") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasColumnType("citext") + .HasMaxLength(512); + + b.Property("PackageKey"); + + b.Property("Version") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Moniker") + .HasColumnType("citext") + .HasMaxLength(256); + + b.Property("PackageKey"); + + b.HasKey("Key"); + + b.HasIndex("Moniker"); + + b.HasIndex("PackageKey"); + + b.ToTable("TargetFrameworks"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("Dependencies") + .HasForeignKey("PackageKey"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("PackageTypes") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.PostgreSql/Migrations/20200109085355_AddReleaseNotesStringColumn.cs b/src/BaGet.Database.PostgreSql/Migrations/20200109085355_AddReleaseNotesStringColumn.cs new file mode 100644 index 00000000..45cd0eac --- /dev/null +++ b/src/BaGet.Database.PostgreSql/Migrations/20200109085355_AddReleaseNotesStringColumn.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace BaGet.Database.PostgreSql.Migrations +{ + public partial class AddReleaseNotesStringColumn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ReleaseNotes", + table: "Packages", + maxLength: 4000, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ReleaseNotes", + table: "Packages"); + } + } +} diff --git a/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs b/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs index b8277d23..d35571ec 100644 --- a/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs +++ b/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs @@ -20,7 +20,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") .HasAnnotation("Relational:MaxIdentifierLength", 63); - modelBuilder.Entity("BaGet.Core.Entities.Package", b => + modelBuilder.Entity("BaGet.Core.Package", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -70,6 +70,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Published"); + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + b.Property("RepositoryType") .HasMaxLength(100); @@ -103,7 +107,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Packages"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -129,7 +133,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageDependencies"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -152,7 +156,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageTypes"); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -172,24 +176,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("TargetFrameworks"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("Dependencies") .HasForeignKey("PackageKey"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("PackageTypes") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("TargetFrameworks") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/BaGet.Database.SqlServer/Migrations/20200109085508_AddReleaseNotesStringColumn.Designer.cs b/src/BaGet.Database.SqlServer/Migrations/20200109085508_AddReleaseNotesStringColumn.Designer.cs new file mode 100644 index 00000000..acf227e7 --- /dev/null +++ b/src/BaGet.Database.SqlServer/Migrations/20200109085508_AddReleaseNotesStringColumn.Designer.cs @@ -0,0 +1,205 @@ +// +using System; +using BaGet.Database.SqlServer; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace BaGet.Database.SqlServer.Migrations +{ + [DbContext(typeof(SqlServerContext))] + [Migration("20200109085508_AddReleaseNotesStringColumn")] + partial class AddReleaseNotesStringColumn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Authors") + .HasMaxLength(4000); + + b.Property("Description") + .HasMaxLength(4000); + + b.Property("Downloads"); + + b.Property("HasReadme"); + + b.Property("IconUrl") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasMaxLength(128); + + b.Property("IsPrerelease"); + + b.Property("Language") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasMaxLength(4000); + + b.Property("Listed"); + + b.Property("MinClientVersion") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasMaxLength(4000); + + b.Property("Published"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + + b.Property("RepositoryType") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate(); + + b.Property("SemVerLevel"); + + b.Property("Summary") + .HasMaxLength(4000); + + b.Property("Tags") + .HasMaxLength(4000); + + b.Property("Title") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("Id", "NormalizedVersionString") + .IsUnique(); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Id") + .HasMaxLength(128); + + b.Property("PackageKey"); + + b.Property("TargetFramework") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasMaxLength(512); + + b.Property("PackageKey"); + + b.Property("Version") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Moniker") + .HasMaxLength(256); + + b.Property("PackageKey"); + + b.HasKey("Key"); + + b.HasIndex("Moniker"); + + b.HasIndex("PackageKey"); + + b.ToTable("TargetFrameworks"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("Dependencies") + .HasForeignKey("PackageKey"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("PackageTypes") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.SqlServer/Migrations/20200109085508_AddReleaseNotesStringColumn.cs b/src/BaGet.Database.SqlServer/Migrations/20200109085508_AddReleaseNotesStringColumn.cs new file mode 100644 index 00000000..4d5f8459 --- /dev/null +++ b/src/BaGet.Database.SqlServer/Migrations/20200109085508_AddReleaseNotesStringColumn.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace BaGet.Database.SqlServer.Migrations +{ + public partial class AddReleaseNotesStringColumn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ReleaseNotes", + table: "Packages", + maxLength: 4000, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ReleaseNotes", + table: "Packages"); + } + } +} diff --git a/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs b/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs index 1bea77cf..db5fe22c 100644 --- a/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs +++ b/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs @@ -19,7 +19,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("BaGet.Core.Entities.Package", b => + modelBuilder.Entity("BaGet.Core.Package", b => { b.Property("Key") .ValueGeneratedOnAdd() @@ -69,6 +69,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Published"); + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + b.Property("RepositoryType") .HasMaxLength(100); @@ -102,7 +106,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Packages"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { b.Property("Key") .ValueGeneratedOnAdd() @@ -128,7 +132,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageDependencies"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { b.Property("Key") .ValueGeneratedOnAdd() @@ -151,7 +155,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageTypes"); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { b.Property("Key") .ValueGeneratedOnAdd() @@ -171,24 +175,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("TargetFrameworks"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("Dependencies") .HasForeignKey("PackageKey"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("PackageTypes") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("TargetFrameworks") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/BaGet.Database.Sqlite/Migrations/20200109071618_AddReleaseNotesStringColumn.Designer.cs b/src/BaGet.Database.Sqlite/Migrations/20200109071618_AddReleaseNotesStringColumn.Designer.cs new file mode 100644 index 00000000..ea480a1b --- /dev/null +++ b/src/BaGet.Database.Sqlite/Migrations/20200109071618_AddReleaseNotesStringColumn.Designer.cs @@ -0,0 +1,202 @@ +// +using System; +using BaGet.Database.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace BaGet.Database.Sqlite.Migrations +{ + [DbContext(typeof(SqliteContext))] + [Migration("20200109071618_AddReleaseNotesStringColumn")] + partial class AddReleaseNotesStringColumn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079"); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Authors") + .HasMaxLength(4000); + + b.Property("Description") + .HasMaxLength(4000); + + b.Property("Downloads"); + + b.Property("HasReadme"); + + b.Property("IconUrl") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(128); + + b.Property("IsPrerelease"); + + b.Property("Language") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasMaxLength(4000); + + b.Property("Listed"); + + b.Property("MinClientVersion") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasMaxLength(4000); + + b.Property("Published"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + + b.Property("RepositoryType") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate(); + + b.Property("SemVerLevel"); + + b.Property("Summary") + .HasMaxLength(4000); + + b.Property("Tags") + .HasMaxLength(4000); + + b.Property("Title") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("Id", "NormalizedVersionString") + .IsUnique(); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Id") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(128); + + b.Property("PackageKey"); + + b.Property("TargetFramework") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(512); + + b.Property("PackageKey"); + + b.Property("Version") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Moniker") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(256); + + b.Property("PackageKey"); + + b.HasKey("Key"); + + b.HasIndex("Moniker"); + + b.HasIndex("PackageKey"); + + b.ToTable("TargetFrameworks"); + }); + + modelBuilder.Entity("BaGet.Core.PackageDependency", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("Dependencies") + .HasForeignKey("PackageKey"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("PackageTypes") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.Sqlite/Migrations/20200109071618_AddReleaseNotesStringColumn.cs b/src/BaGet.Database.Sqlite/Migrations/20200109071618_AddReleaseNotesStringColumn.cs new file mode 100644 index 00000000..5de5d390 --- /dev/null +++ b/src/BaGet.Database.Sqlite/Migrations/20200109071618_AddReleaseNotesStringColumn.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace BaGet.Database.Sqlite.Migrations +{ + public partial class AddReleaseNotesStringColumn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ReleaseNotes", + table: "Packages", + maxLength: 4000, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ReleaseNotes", + table: "Packages"); + } + } +} diff --git a/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs b/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs index f2c17702..5441658c 100644 --- a/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs +++ b/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs @@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder .HasAnnotation("ProductVersion", "2.2.6-servicing-10079"); - modelBuilder.Entity("BaGet.Core.Entities.Package", b => + modelBuilder.Entity("BaGet.Core.Package", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -66,6 +66,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Published"); + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasMaxLength(4000); + b.Property("RepositoryType") .HasMaxLength(100); @@ -99,7 +103,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Packages"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -125,7 +129,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageDependencies"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -148,7 +152,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PackageTypes"); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { b.Property("Key") .ValueGeneratedOnAdd(); @@ -168,24 +172,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("TargetFrameworks"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b => + modelBuilder.Entity("BaGet.Core.PackageDependency", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("Dependencies") .HasForeignKey("PackageKey"); }); - modelBuilder.Entity("BaGet.Core.Entities.PackageType", b => + modelBuilder.Entity("BaGet.Core.PackageType", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("PackageTypes") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b => + modelBuilder.Entity("BaGet.Core.TargetFramework", b => { - b.HasOne("BaGet.Core.Entities.Package", "Package") + b.HasOne("BaGet.Core.Package", "Package") .WithMany("TargetFrameworks") .HasForeignKey("PackageKey") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/BaGet.UI/src/DisplayPackage/DisplayPackage.css b/src/BaGet.UI/src/DisplayPackage/DisplayPackage.css index d6c2e48e..9928c11d 100644 --- a/src/BaGet.UI/src/DisplayPackage/DisplayPackage.css +++ b/src/BaGet.UI/src/DisplayPackage/DisplayPackage.css @@ -16,6 +16,10 @@ white-space: pre-wrap; } +.display-package .package-release-notes { + white-space: pre-wrap; +} + .package-details-info { margin-top: -25px; } diff --git a/src/BaGet.UI/src/DisplayPackage/DisplayPackage.tsx b/src/BaGet.UI/src/DisplayPackage/DisplayPackage.tsx index 1857f8e4..385d1f83 100644 --- a/src/BaGet.UI/src/DisplayPackage/DisplayPackage.tsx +++ b/src/BaGet.UI/src/DisplayPackage/DisplayPackage.tsx @@ -37,6 +37,7 @@ interface IPackage { downloadUrl: string; repositoryUrl: string; repositoryType: string; + releaseNotes: string; totalDownloads: number; packageType: PackageType; downloads: number; @@ -249,6 +250,12 @@ class DisplayPackage extends React.Component + {this.state.package.releaseNotes && + +
{this.state.package.releaseNotes}
+
+ } + diff --git a/src/BaGet.UI/src/DisplayPackage/Registration.tsx b/src/BaGet.UI/src/DisplayPackage/Registration.tsx index 49f4254d..dea000bb 100644 --- a/src/BaGet.UI/src/DisplayPackage/Registration.tsx +++ b/src/BaGet.UI/src/DisplayPackage/Registration.tsx @@ -25,6 +25,7 @@ export interface ICatalogEntry { iconUrl: string; projectUrl: string; licenseUrl: string; + releaseNotes: string; listed: boolean; packageTypes: string[]; repositoryUrl: string;