Skip to content

Commit

Permalink
Add initial migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tsundvoll committed Nov 27, 2024
1 parent b61fdf2 commit e086458
Show file tree
Hide file tree
Showing 3 changed files with 388 additions and 0 deletions.
159 changes: 159 additions & 0 deletions api/Migrations/20241127092258_InitialCreate.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions api/Migrations/20241127092258_InitialCreate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace api.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InspectionData",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
InspectionId = table.Column<string>(type: "text", nullable: false),
RawDataBlobStorageLocation_StorageAccount = table.Column<string>(type: "text", nullable: false),
RawDataBlobStorageLocation_BlobContainer = table.Column<string>(type: "text", nullable: false),
RawDataBlobStorageLocation_BlobName = table.Column<string>(type: "text", nullable: false),
AnonymizedBlobStorageLocation_StorageAccount = table.Column<string>(type: "text", nullable: false),
AnonymizedBlobStorageLocation_BlobContainer = table.Column<string>(type: "text", nullable: false),
AnonymizedBlobStorageLocation_BlobName = table.Column<string>(type: "text", nullable: false),
InstallationCode = table.Column<string>(type: "text", nullable: false),
AnonymizerWorkflowStatus = table.Column<int>(type: "integer", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
AnalysisToBeRun = table.Column<int[]>(type: "integer[]", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InspectionData", x => x.Id);
});

migrationBuilder.CreateTable(
name: "Analysis",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Uri = table.Column<string>(type: "text", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Type = table.Column<int>(type: "integer", nullable: true),
Status = table.Column<int>(type: "integer", nullable: false),
InspectionDataId = table.Column<string>(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");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Analysis");

migrationBuilder.DropTable(
name: "InspectionData");
}
}
}
156 changes: 156 additions & 0 deletions api/Migrations/IdaDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using api.Models;

#nullable disable

namespace api.Migrations
{
[DbContext(typeof(IdaDbContext))]
partial class IdaDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

modelBuilder.Entity("api.Models.Analysis", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<string>("InspectionDataId")
.HasColumnType("text");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<int?>("Type")
.HasColumnType("integer");
b.Property<string>("Uri")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("InspectionDataId");
b.ToTable("Analysis");
});

modelBuilder.Entity("api.Models.InspectionData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property<int[]>("AnalysisToBeRun")
.IsRequired()
.HasColumnType("integer[]");
b.Property<int>("AnonymizerWorkflowStatus")
.HasColumnType("integer");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<string>("InspectionId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("InstallationCode")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("InspectionData");
});

modelBuilder.Entity("api.Models.Analysis", b =>
{
b.HasOne("api.Models.InspectionData", null)
.WithMany("Analysis")
.HasForeignKey("InspectionDataId");
});

modelBuilder.Entity("api.Models.InspectionData", b =>
{
b.OwnsOne("api.Models.BlobStorageLocation", "AnonymizedBlobStorageLocation", b1 =>
{
b1.Property<string>("InspectionDataId")
.HasColumnType("text");
b1.Property<string>("BlobContainer")
.IsRequired()
.HasColumnType("text");
b1.Property<string>("BlobName")
.IsRequired()
.HasColumnType("text");
b1.Property<string>("StorageAccount")
.IsRequired()
.HasColumnType("text");
b1.HasKey("InspectionDataId");
b1.ToTable("InspectionData");
b1.WithOwner()
.HasForeignKey("InspectionDataId");
});
b.OwnsOne("api.Models.BlobStorageLocation", "RawDataBlobStorageLocation", b1 =>
{
b1.Property<string>("InspectionDataId")
.HasColumnType("text");
b1.Property<string>("BlobContainer")
.IsRequired()
.HasColumnType("text");
b1.Property<string>("BlobName")
.IsRequired()
.HasColumnType("text");
b1.Property<string>("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.Models.InspectionData", b =>
{
b.Navigation("Analysis");
});
#pragma warning restore 612, 618
}
}
}

0 comments on commit e086458

Please sign in to comment.