From b5bfd168e88e9608ab2983904d736708595f98b1 Mon Sep 17 00:00:00 2001
From: Thomas Sundvoll <35451859+tsundvoll@users.noreply.github.com>
Date: Wed, 27 Nov 2024 14:07:09 +0100
Subject: [PATCH] Add initial migration again
---
.../20241127130258_InitialCreate.Designer.cs | 159 ++++++++++++++++++
.../20241127130258_InitialCreate.cs | 73 ++++++++
2 files changed, 232 insertions(+)
create mode 100644 api/Migrations/20241127130258_InitialCreate.Designer.cs
create mode 100644 api/Migrations/20241127130258_InitialCreate.cs
diff --git a/api/Migrations/20241127130258_InitialCreate.Designer.cs b/api/Migrations/20241127130258_InitialCreate.Designer.cs
new file mode 100644
index 0000000..d9dfabb
--- /dev/null
+++ b/api/Migrations/20241127130258_InitialCreate.Designer.cs
@@ -0,0 +1,159 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using api.Database;
+
+#nullable disable
+
+namespace api.Migrations
+{
+ [DbContext(typeof(IdaDbContext))]
+ [Migration("20241127130258_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.8")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("api.Database.Analysis", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("text");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("InspectionDataId")
+ .HasColumnType("text");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.Property("Uri")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("InspectionDataId");
+
+ b.ToTable("Analysis");
+ });
+
+ modelBuilder.Entity("api.Database.InspectionData", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("text");
+
+ b.Property("AnalysisToBeRun")
+ .IsRequired()
+ .HasColumnType("integer[]");
+
+ b.Property("AnonymizerWorkflowStatus")
+ .HasColumnType("integer");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("InspectionId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("InstallationCode")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("InspectionData");
+ });
+
+ modelBuilder.Entity("api.Database.Analysis", b =>
+ {
+ b.HasOne("api.Database.InspectionData", null)
+ .WithMany("Analysis")
+ .HasForeignKey("InspectionDataId");
+ });
+
+ modelBuilder.Entity("api.Database.InspectionData", b =>
+ {
+ b.OwnsOne("api.Database.BlobStorageLocation", "AnonymizedBlobStorageLocation", b1 =>
+ {
+ b1.Property("InspectionDataId")
+ .HasColumnType("text");
+
+ b1.Property("BlobContainer")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b1.Property("BlobName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b1.Property("StorageAccount")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b1.HasKey("InspectionDataId");
+
+ b1.ToTable("InspectionData");
+
+ b1.WithOwner()
+ .HasForeignKey("InspectionDataId");
+ });
+
+ b.OwnsOne("api.Database.BlobStorageLocation", "RawDataBlobStorageLocation", b1 =>
+ {
+ b1.Property("InspectionDataId")
+ .HasColumnType("text");
+
+ b1.Property("BlobContainer")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b1.Property("BlobName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b1.Property("StorageAccount")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b1.HasKey("InspectionDataId");
+
+ b1.ToTable("InspectionData");
+
+ b1.WithOwner()
+ .HasForeignKey("InspectionDataId");
+ });
+
+ b.Navigation("AnonymizedBlobStorageLocation")
+ .IsRequired();
+
+ b.Navigation("RawDataBlobStorageLocation")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("api.Database.InspectionData", b =>
+ {
+ b.Navigation("Analysis");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/api/Migrations/20241127130258_InitialCreate.cs b/api/Migrations/20241127130258_InitialCreate.cs
new file mode 100644
index 0000000..9385829
--- /dev/null
+++ b/api/Migrations/20241127130258_InitialCreate.cs
@@ -0,0 +1,73 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace api.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "InspectionData",
+ columns: table => new
+ {
+ Id = table.Column(type: "text", nullable: false),
+ InspectionId = table.Column(type: "text", nullable: false),
+ RawDataBlobStorageLocation_StorageAccount = table.Column(type: "text", nullable: false),
+ RawDataBlobStorageLocation_BlobContainer = table.Column(type: "text", nullable: false),
+ RawDataBlobStorageLocation_BlobName = table.Column(type: "text", nullable: false),
+ AnonymizedBlobStorageLocation_StorageAccount = table.Column(type: "text", nullable: false),
+ AnonymizedBlobStorageLocation_BlobContainer = table.Column(type: "text", nullable: false),
+ AnonymizedBlobStorageLocation_BlobName = table.Column(type: "text", nullable: false),
+ InstallationCode = table.Column(type: "text", nullable: false),
+ AnonymizerWorkflowStatus = table.Column(type: "integer", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ AnalysisToBeRun = table.Column(type: "integer[]", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_InspectionData", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Analysis",
+ columns: table => new
+ {
+ Id = table.Column(type: "text", nullable: false),
+ Uri = table.Column(type: "text", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ Type = table.Column(type: "integer", nullable: true),
+ Status = table.Column(type: "integer", nullable: false),
+ InspectionDataId = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Analysis", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Analysis_InspectionData_InspectionDataId",
+ column: x => x.InspectionDataId,
+ principalTable: "InspectionData",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Analysis_InspectionDataId",
+ table: "Analysis",
+ column: "InspectionDataId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Analysis");
+
+ migrationBuilder.DropTable(
+ name: "InspectionData");
+ }
+ }
+}