From f8f40e0bb5330dbe736fdee488c7b31251eaa2c2 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Tue, 11 Jun 2024 14:45:38 +0200 Subject: [PATCH] Add CQCHookEndpoint to DB model --- .../Data/DataInitializer.cs | 3 +- ...20240611124347_addHookEndpoint.Designer.cs | 199 ++++++++++++++++++ .../20240611124347_addHookEndpoint.cs | 28 +++ .../ValidationPackageDbModelSnapshot.cs | 3 + .../Models/ValidationPackage.cs | 4 + 5 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.Designer.cs create mode 100644 src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.cs diff --git a/src/PackageRegistryService/Data/DataInitializer.cs b/src/PackageRegistryService/Data/DataInitializer.cs index 5809fe6..4cf4369 100644 --- a/src/PackageRegistryService/Data/DataInitializer.cs +++ b/src/PackageRegistryService/Data/DataInitializer.cs @@ -51,7 +51,8 @@ public static void SeedData(ValidationPackageDb context) ReleaseDate = new(i.LastUpdated.Year, i.LastUpdated.Month, i.LastUpdated.Day), Tags = i.Metadata.Tags, ReleaseNotes = i.Metadata.ReleaseNotes, - Authors = i.Metadata.Authors + Authors = i.Metadata.Authors, + CQCHookEndpoint = i.Metadata.CQCHookEndpoint }; }); diff --git a/src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.Designer.cs b/src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.Designer.cs new file mode 100644 index 0000000..30def5b --- /dev/null +++ b/src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.Designer.cs @@ -0,0 +1,199 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using PackageRegistryService.Models; + +#nullable disable + +namespace PackageRegistryService.Migrations +{ + [DbContext(typeof(ValidationPackageDb))] + [Migration("20240611124347_addHookEndpoint")] + partial class addHookEndpoint + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("PackageRegistryService.Models.PackageContentHash", b => + { + b.Property("PackageName") + .HasColumnType("text"); + + b.Property("PackageMajorVersion") + .HasColumnType("integer"); + + b.Property("PackageMinorVersion") + .HasColumnType("integer"); + + b.Property("PackagePatchVersion") + .HasColumnType("integer"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("PackageName", "PackageMajorVersion", "PackageMinorVersion", "PackagePatchVersion"); + + b.ToTable("Hashes"); + }); + + modelBuilder.Entity("PackageRegistryService.Models.PackageDownloads", b => + { + b.Property("PackageName") + .HasColumnType("text"); + + b.Property("PackageMajorVersion") + .HasColumnType("integer"); + + b.Property("PackageMinorVersion") + .HasColumnType("integer"); + + b.Property("PackagePatchVersion") + .HasColumnType("integer"); + + b.Property("Downloads") + .HasColumnType("integer"); + + b.HasKey("PackageName", "PackageMajorVersion", "PackageMinorVersion", "PackagePatchVersion"); + + b.ToTable("Downloads"); + }); + + modelBuilder.Entity("PackageRegistryService.Models.ValidationPackage", b => + { + b.Property("Name") + .HasColumnType("text"); + + b.Property("MajorVersion") + .HasColumnType("integer"); + + b.Property("MinorVersion") + .HasColumnType("integer"); + + b.Property("PatchVersion") + .HasColumnType("integer"); + + b.Property("CQCHookEndpoint") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("PackageContent") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ReleaseNotes") + .HasColumnType("text"); + + b.Property("Summary") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Name", "MajorVersion", "MinorVersion", "PatchVersion"); + + b.ToTable("ValidationPackages"); + }); + + modelBuilder.Entity("PackageRegistryService.Models.ValidationPackage", b => + { + b.OwnsMany("AVPRIndex.Domain+Author", "Authors", b1 => + { + b1.Property("ValidationPackageName") + .HasColumnType("text"); + + b1.Property("ValidationPackageMajorVersion") + .HasColumnType("integer"); + + b1.Property("ValidationPackageMinorVersion") + .HasColumnType("integer"); + + b1.Property("ValidationPackagePatchVersion") + .HasColumnType("integer"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + b1.Property("Affiliation") + .HasColumnType("text"); + + b1.Property("AffiliationLink") + .HasColumnType("text"); + + b1.Property("Email") + .HasColumnType("text"); + + b1.Property("FullName") + .HasColumnType("text"); + + b1.HasKey("ValidationPackageName", "ValidationPackageMajorVersion", "ValidationPackageMinorVersion", "ValidationPackagePatchVersion", "Id"); + + b1.ToTable("ValidationPackages"); + + b1.ToJson("Authors"); + + b1.WithOwner() + .HasForeignKey("ValidationPackageName", "ValidationPackageMajorVersion", "ValidationPackageMinorVersion", "ValidationPackagePatchVersion"); + }); + + b.OwnsMany("AVPRIndex.Domain+OntologyAnnotation", "Tags", b1 => + { + b1.Property("ValidationPackageName") + .HasColumnType("text"); + + b1.Property("ValidationPackageMajorVersion") + .HasColumnType("integer"); + + b1.Property("ValidationPackageMinorVersion") + .HasColumnType("integer"); + + b1.Property("ValidationPackagePatchVersion") + .HasColumnType("integer"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + b1.Property("Name") + .HasColumnType("text"); + + b1.Property("TermAccessionNumber") + .HasColumnType("text"); + + b1.Property("TermSourceREF") + .HasColumnType("text"); + + b1.HasKey("ValidationPackageName", "ValidationPackageMajorVersion", "ValidationPackageMinorVersion", "ValidationPackagePatchVersion", "Id"); + + b1.ToTable("ValidationPackages"); + + b1.ToJson("Tags"); + + b1.WithOwner() + .HasForeignKey("ValidationPackageName", "ValidationPackageMajorVersion", "ValidationPackageMinorVersion", "ValidationPackagePatchVersion"); + }); + + b.Navigation("Authors"); + + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.cs b/src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.cs new file mode 100644 index 0000000..f1ff710 --- /dev/null +++ b/src/PackageRegistryService/Migrations/20240611124347_addHookEndpoint.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PackageRegistryService.Migrations +{ + /// + public partial class addHookEndpoint : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CQCHookEndpoint", + table: "ValidationPackages", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CQCHookEndpoint", + table: "ValidationPackages"); + } + } +} diff --git a/src/PackageRegistryService/Migrations/ValidationPackageDbModelSnapshot.cs b/src/PackageRegistryService/Migrations/ValidationPackageDbModelSnapshot.cs index 846eeff..365d409 100644 --- a/src/PackageRegistryService/Migrations/ValidationPackageDbModelSnapshot.cs +++ b/src/PackageRegistryService/Migrations/ValidationPackageDbModelSnapshot.cs @@ -81,6 +81,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PatchVersion") .HasColumnType("integer"); + b.Property("CQCHookEndpoint") + .HasColumnType("text"); + b.Property("Description") .IsRequired() .HasColumnType("text"); diff --git a/src/PackageRegistryService/Models/ValidationPackage.cs b/src/PackageRegistryService/Models/ValidationPackage.cs index fa7d2fe..0f478f0 100644 --- a/src/PackageRegistryService/Models/ValidationPackage.cs +++ b/src/PackageRegistryService/Models/ValidationPackage.cs @@ -72,6 +72,10 @@ public class ValidationPackage /// /// /// + public string? CQCHookEndpoint { get; set; } + /// + /// + /// public ICollection? Authors { get; set; } // https://www.learnentityframeworkcore.com/relationships#navigation-properties /// ///