Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dummy model #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/Database/Context/IdaDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ public class IdaDbContext(DbContextOptions options) : DbContext(options)
public DbSet<InspectionData> InspectionData { get; set; } = null!;

public DbSet<Analysis> Analysis { get; set; } = null!;

public DbSet<DummyDataToTestMigration> DummyDataToTestMigrations { get; set; } = null!;
}
}
10 changes: 10 additions & 0 deletions api/Database/Models/InspectionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ public static AnalysisType TypeFromString(string status)
}
}

public class DummyDataToTestMigration
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

[Required]
public string Name { get; set; }
}

public enum AnalysisStatus
{
NotStarted,
Expand Down
174 changes: 174 additions & 0 deletions api/Migrations/20241127123610_AddDummyDataToTestMigration.Designer.cs

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

33 changes: 33 additions & 0 deletions api/Migrations/20241127123610_AddDummyDataToTestMigration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace api.Migrations
{
/// <inheritdoc />
public partial class AddDummyDataToTestMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DummyDataToTestMigrations",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DummyDataToTestMigrations", x => x.Id);
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DummyDataToTestMigrations");
}
}
}
15 changes: 15 additions & 0 deletions api/Migrations/IdaDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("Analysis");
});

modelBuilder.Entity("api.Database.DummyDataToTestMigration", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");

b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");

b.HasKey("Id");

b.ToTable("DummyDataToTestMigrations");
});

modelBuilder.Entity("api.Database.InspectionData", b =>
{
b.Property<string>("Id")
Expand Down
Loading