From da684e34aee60849ef13a6f8625e57583e0da370 Mon Sep 17 00:00:00 2001 From: Loic Sharma Date: Sun, 19 Sep 2021 12:28:15 -0700 Subject: [PATCH] Start --- src/BaGet.Core/Entities/AbstractContext.cs | 3 +- ...54_RemoveReleaseNotesMaxLength.Designer.cs | 240 +++++++++++++++++ ...10919191554_RemoveReleaseNotesMaxLength.cs | 35 +++ .../Migrations/MySqlContextModelSnapshot.cs | 5 +- ...49_RemoveReleaseNotesMaxLength.Designer.cs | 247 ++++++++++++++++++ ...10919191649_RemoveReleaseNotesMaxLength.cs | 31 +++ .../PostgreSqlContextModelSnapshot.cs | 5 +- ...28_RemoveReleaseNotesMaxLength.Designer.cs | 246 +++++++++++++++++ ...10919191928_RemoveReleaseNotesMaxLength.cs | 31 +++ .../SqlServerContextModelSnapshot.cs | 5 +- ...49_RemoveReleaseNotesMaxLength.Designer.cs | 239 +++++++++++++++++ ...10919190849_RemoveReleaseNotesMaxLength.cs | 17 ++ .../Migrations/SqliteContextModelSnapshot.cs | 5 +- 13 files changed, 1095 insertions(+), 14 deletions(-) create mode 100644 src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.Designer.cs create mode 100644 src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.cs create mode 100644 src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.Designer.cs create mode 100644 src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.cs create mode 100644 src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.Designer.cs create mode 100644 src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.cs create mode 100644 src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.Designer.cs create mode 100644 src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.cs diff --git a/src/BaGet.Core/Entities/AbstractContext.cs b/src/BaGet.Core/Entities/AbstractContext.cs index ccccef128..7c8c2482d 100644 --- a/src/BaGet.Core/Entities/AbstractContext.cs +++ b/src/BaGet.Core/Entities/AbstractContext.cs @@ -68,8 +68,7 @@ private void BuildPackageEntity(EntityTypeBuilder package) .HasMaxLength(MaxPackageVersionLength); package.Property(p => p.ReleaseNotes) - .HasColumnName("ReleaseNotes") - .HasMaxLength(DefaultMaxStringLength); + .HasColumnName("ReleaseNotes"); package.Property(p => p.Authors) .HasMaxLength(DefaultMaxStringLength) diff --git a/src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.Designer.cs b/src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.Designer.cs new file mode 100644 index 000000000..cc7b84a2a --- /dev/null +++ b/src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.Designer.cs @@ -0,0 +1,240 @@ +// +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("20210919191554_RemoveReleaseNotesMaxLength")] + partial class RemoveReleaseNotesMaxLength + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.18") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Authors") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Downloads") + .HasColumnType("bigint"); + + b.Property("HasEmbeddedIcon") + .HasColumnType("tinyint(1)"); + + b.Property("HasReadme") + .HasColumnType("tinyint(1)"); + + b.Property("IconUrl") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("IsPrerelease") + .HasColumnType("tinyint(1)"); + + b.Property("Language") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Listed") + .HasColumnType("tinyint(1)"); + + b.Property("MinClientVersion") + .HasColumnType("varchar(44) CHARACTER SET utf8mb4") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Published") + .HasColumnType("datetime(6)"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RepositoryType") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance") + .HasColumnType("tinyint(1)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp(6)"); + + b.Property("SemVerLevel") + .HasColumnType("int"); + + b.Property("Summary") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Tags") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(4000); + + b.Property("Title") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .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() + .HasColumnType("int"); + + b.Property("Id") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("PackageKey") + .HasColumnType("int"); + + b.Property("TargetFramework") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("PackageKey") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Moniker") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("PackageKey") + .HasColumnType("int"); + + 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) + .IsRequired(); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.cs b/src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.cs new file mode 100644 index 000000000..de331311c --- /dev/null +++ b/src/BaGet.Database.MySql/Migrations/20210919191554_RemoveReleaseNotesMaxLength.cs @@ -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( + 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( + name: "RowVersion", + table: "Packages", + type: "timestamp(6)", + nullable: true, + oldClrType: typeof(DateTime), + oldRowVersion: true, + oldNullable: true) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn); + } + } +} diff --git a/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs b/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs index 363c445c0..d9a6e93c8 100644 --- a/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs +++ b/src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs @@ -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("ReleaseNotes") .HasColumnName("ReleaseNotes") - .HasColumnType("longtext CHARACTER SET utf8mb4") - .HasMaxLength(4000); + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("RepositoryType") .HasColumnType("varchar(100) CHARACTER SET utf8mb4") diff --git a/src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.Designer.cs b/src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.Designer.cs new file mode 100644 index 000000000..d90adb861 --- /dev/null +++ b/src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.Designer.cs @@ -0,0 +1,247 @@ +// +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("20210919191649_RemoveReleaseNotesMaxLength")] + partial class RemoveReleaseNotesMaxLength + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:PostgresExtension:citext", ",,") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.18") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Authors") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Downloads") + .HasColumnType("bigint"); + + b.Property("HasEmbeddedIcon") + .HasColumnType("boolean"); + + b.Property("HasReadme") + .HasColumnType("boolean"); + + b.Property("IconUrl") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasColumnType("citext") + .HasMaxLength(128); + + b.Property("IsPrerelease") + .HasColumnType("boolean"); + + b.Property("Language") + .HasColumnType("character varying(20)") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Listed") + .HasColumnType("boolean"); + + b.Property("MinClientVersion") + .HasColumnType("character varying(44)") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("citext") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasColumnType("character varying(64)") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Published") + .HasColumnType("timestamp without time zone"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasColumnType("text"); + + b.Property("RepositoryType") + .HasColumnType("character varying(100)") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance") + .HasColumnType("boolean"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("bytea"); + + b.Property("SemVerLevel") + .HasColumnType("integer"); + + b.Property("Summary") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Tags") + .HasColumnType("character varying(4000)") + .HasMaxLength(4000); + + b.Property("Title") + .HasColumnType("character varying(256)") + .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() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Id") + .HasColumnType("citext") + .HasMaxLength(128); + + b.Property("PackageKey") + .HasColumnType("integer"); + + b.Property("TargetFramework") + .HasColumnType("character varying(256)") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasColumnType("character varying(256)") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Name") + .HasColumnType("citext") + .HasMaxLength(512); + + b.Property("PackageKey") + .HasColumnType("integer"); + + b.Property("Version") + .HasColumnType("character varying(64)") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Moniker") + .HasColumnType("citext") + .HasMaxLength(256); + + b.Property("PackageKey") + .HasColumnType("integer"); + + 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) + .IsRequired(); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.cs b/src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.cs new file mode 100644 index 000000000..daa3eac43 --- /dev/null +++ b/src/BaGet.Database.PostgreSql/Migrations/20210919191649_RemoveReleaseNotesMaxLength.cs @@ -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( + 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( + name: "ReleaseNotes", + table: "Packages", + type: "character varying(4000)", + maxLength: 4000, + nullable: true, + oldClrType: typeof(string), + oldNullable: true); + } + } +} diff --git a/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs b/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs index 36ae9b635..873f69770 100644 --- a/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs +++ b/src/BaGet.Database.PostgreSql/Migrations/PostgreSqlContextModelSnapshot.cs @@ -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("ReleaseNotes") .HasColumnName("ReleaseNotes") - .HasColumnType("character varying(4000)") - .HasMaxLength(4000); + .HasColumnType("text"); b.Property("RepositoryType") .HasColumnType("character varying(100)") diff --git a/src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.Designer.cs b/src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.Designer.cs new file mode 100644 index 000000000..7db50ee59 --- /dev/null +++ b/src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.Designer.cs @@ -0,0 +1,246 @@ +// +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("20210919191928_RemoveReleaseNotesMaxLength")] + partial class RemoveReleaseNotesMaxLength + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.18") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Authors") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Downloads") + .HasColumnType("bigint"); + + b.Property("HasEmbeddedIcon") + .HasColumnType("bit"); + + b.Property("HasReadme") + .HasColumnType("bit"); + + b.Property("IconUrl") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("IsPrerelease") + .HasColumnType("bit"); + + b.Property("Language") + .HasColumnType("nvarchar(20)") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Listed") + .HasColumnType("bit"); + + b.Property("MinClientVersion") + .HasColumnType("nvarchar(44)") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Published") + .HasColumnType("datetime2"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("RepositoryType") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance") + .HasColumnType("bit"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("SemVerLevel") + .HasColumnType("int"); + + b.Property("Summary") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Tags") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Title") + .HasColumnType("nvarchar(256)") + .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() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Id") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("PackageKey") + .HasColumnType("int"); + + b.Property("TargetFramework") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("PackageKey") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Moniker") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PackageKey") + .HasColumnType("int"); + + 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) + .IsRequired(); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.cs b/src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.cs new file mode 100644 index 000000000..1d1080e9c --- /dev/null +++ b/src/BaGet.Database.SqlServer/Migrations/20210919191928_RemoveReleaseNotesMaxLength.cs @@ -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( + name: "ReleaseNotes", + table: "Packages", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(4000)", + oldMaxLength: 4000, + oldNullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ReleaseNotes", + table: "Packages", + type: "nvarchar(4000)", + maxLength: 4000, + nullable: true, + oldClrType: typeof(string), + oldNullable: true); + } + } +} diff --git a/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs b/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs index 229a30020..331afcb78 100644 --- a/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs +++ b/src/BaGet.Database.SqlServer/Migrations/SqlServerContextModelSnapshot.cs @@ -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("ReleaseNotes") .HasColumnName("ReleaseNotes") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnType("nvarchar(max)"); b.Property("RepositoryType") .HasColumnType("nvarchar(100)") diff --git a/src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.Designer.cs b/src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.Designer.cs new file mode 100644 index 000000000..6d54a7128 --- /dev/null +++ b/src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.Designer.cs @@ -0,0 +1,239 @@ +// +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("20210919190849_RemoveReleaseNotesMaxLength")] + partial class RemoveReleaseNotesMaxLength + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.18"); + + modelBuilder.Entity("BaGet.Core.Package", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Authors") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Downloads") + .HasColumnType("INTEGER"); + + b.Property("HasEmbeddedIcon") + .HasColumnType("INTEGER"); + + b.Property("HasReadme") + .HasColumnType("INTEGER"); + + b.Property("IconUrl") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Id") + .IsRequired() + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(128); + + b.Property("IsPrerelease") + .HasColumnType("INTEGER"); + + b.Property("Language") + .HasColumnType("TEXT") + .HasMaxLength(20); + + b.Property("LicenseUrl") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Listed") + .HasColumnType("INTEGER"); + + b.Property("MinClientVersion") + .HasColumnType("TEXT") + .HasMaxLength(44); + + b.Property("NormalizedVersionString") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(64); + + b.Property("OriginalVersionString") + .HasColumnName("OriginalVersion") + .HasColumnType("TEXT") + .HasMaxLength(64); + + b.Property("ProjectUrl") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Published") + .HasColumnType("TEXT"); + + b.Property("ReleaseNotes") + .HasColumnName("ReleaseNotes") + .HasColumnType("TEXT"); + + b.Property("RepositoryType") + .HasColumnType("TEXT") + .HasMaxLength(100); + + b.Property("RepositoryUrl") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("RequireLicenseAcceptance") + .HasColumnType("INTEGER"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("BLOB"); + + b.Property("SemVerLevel") + .HasColumnType("INTEGER"); + + b.Property("Summary") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Tags") + .HasColumnType("TEXT") + .HasMaxLength(4000); + + b.Property("Title") + .HasColumnType("TEXT") + .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() + .HasColumnType("INTEGER"); + + b.Property("Id") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(128); + + b.Property("PackageKey") + .HasColumnType("INTEGER"); + + b.Property("TargetFramework") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.Property("VersionRange") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.HasKey("Key"); + + b.HasIndex("Id"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageDependencies"); + }); + + modelBuilder.Entity("BaGet.Core.PackageType", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(512); + + b.Property("PackageKey") + .HasColumnType("INTEGER"); + + b.Property("Version") + .HasColumnType("TEXT") + .HasMaxLength(64); + + b.HasKey("Key"); + + b.HasIndex("Name"); + + b.HasIndex("PackageKey"); + + b.ToTable("PackageTypes"); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.Property("Key") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Moniker") + .HasColumnType("TEXT COLLATE NOCASE") + .HasMaxLength(256); + + b.Property("PackageKey") + .HasColumnType("INTEGER"); + + 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) + .IsRequired(); + }); + + modelBuilder.Entity("BaGet.Core.TargetFramework", b => + { + b.HasOne("BaGet.Core.Package", "Package") + .WithMany("TargetFrameworks") + .HasForeignKey("PackageKey") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.cs b/src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.cs new file mode 100644 index 000000000..7077efbfc --- /dev/null +++ b/src/BaGet.Database.Sqlite/Migrations/20210919190849_RemoveReleaseNotesMaxLength.cs @@ -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) + { + + } + } +} diff --git a/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs b/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs index 1d99d5cd6..ddac0c1e6 100644 --- a/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs +++ b/src/BaGet.Database.Sqlite/Migrations/SqliteContextModelSnapshot.cs @@ -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("ReleaseNotes") .HasColumnName("ReleaseNotes") - .HasColumnType("TEXT") - .HasMaxLength(4000); + .HasColumnType("TEXT"); b.Property("RepositoryType") .HasColumnType("TEXT")